﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Text;
using netDxf;
using netDxf.Blocks;
using netDxf.Collections;
using netDxf.Entities;
using netDxf.Header;
using netDxf.Objects;
using netDxf.Tables;
using netDxf.Units;
using Attribute = netDxf.Entities.Attribute;
using Image = netDxf.Entities.Image;
using Point = netDxf.Entities.Point;
using Trace = netDxf.Entities.Trace;
using System.Threading;

namespace TestDxfDocument
{
    class _7to24Tapertoolhandle
    {
        public static void Tapertoolhandle(Dictionary<string, Object> data)    //7:24圆锥
        {
            DxfDocument dxf = new DxfDocument();
            //图层
            Layer contour = new Layer("contour") { Color = AciColor.Cyan };    //轮廓层
            Layer dimensioning = new Layer("dimensioning");    //尺寸层
            Layer refin = new Layer("refin") { Color = AciColor.Red };    //基准线/内轮廓
            Layer centre = new Layer("centre") { Color = AciColor.Yellow };    //中性线
            Layer textlayer = new Layer("textlayer") { Color = AciColor.Blue };    //文本层
            Layer hatching = new Layer("hatching") { Color = AciColor.Blue };    //填充层
            Layer additionalline = new Layer("additionalline") { Color = AciColor.Cyan };    //附加线
            Layer cutting = new Layer("cutting") { Color = AciColor.Red };    //切削层
            Layer nocutting = new Layer("nocutting");    //非切削层
            Layer skcontour = new Layer("skcontour") { Color = AciColor.Cyan };    //sk轮廓层
            Layer skdimensioning = new Layer("skdimensioning");    //sk尺寸线层
            Layer skrefin = new Layer("skrefin") { Color = AciColor.Red };    //sk基准线/内轮廓
            Layer sktext = new Layer("sktext") { Color = AciColor.Blue };  //sk文本
            Layer skhatching = new Layer("skhatching") { Color = AciColor.Blue };    //sk填充
            Layer skadditionlline = new Layer("skadditionlline") { Color = AciColor.Cyan };    //sk附加线
            Layer skviewcontour = new Layer("skviewcontour") { Color = AciColor.Cyan };    //skview轮廓
            Layer skviewdimensioning = new Layer("skviewdimensioning");    //skview尺寸线层

            //参数
            double scale = 1; //放大系数
            double l1 = Convert.ToDouble(data["l1"]) * scale;
            double l2 = Convert.ToDouble(data["l2"]) * scale;
            double l3 = Convert.ToDouble(data["l3"]) * scale;
            double l4 = Convert.ToDouble(data["l4"]) * scale;
            double l5 = Convert.ToDouble(data["l5"]) * scale;
            double l6 = Convert.ToDouble(data["l6"]) * scale;
            double l7 = Convert.ToDouble(data["l7"]) * scale;
            double r1 = Convert.ToDouble(data["r1"]) * scale;
            double b = Convert.ToDouble(data["b"]) * scale;
            double d1 = Convert.ToDouble(data["d1"]) * scale;
            double d2 = Convert.ToDouble(data["d2"]) * scale;
            double d3 = Convert.ToDouble(data["d3"]) * scale;
            double d4 = Convert.ToDouble(data["d4"]) * scale;
            double d5 = Convert.ToDouble(data["d5"]) * scale;
            double d6 = Convert.ToDouble(data["d6"]) * scale;
            double d7 = Convert.ToDouble(data["d7"]) * scale;
            double d11 = Convert.ToDouble(data["d11"]) * scale;
            double d12 = Convert.ToDouble(data["d12"]) * scale;
            double e = Convert.ToDouble(data["e"]) * scale;
            double fb = Convert.ToDouble(data["fb"]) * scale;
            double j = Convert.ToDouble(data["j"]) * scale;
            double r2 = Convert.ToDouble(data["r2"]) * scale;
            double r3 = Convert.ToDouble(data["r3"]) * scale;
            double t1 = Convert.ToDouble(data["t1"]) * scale;
            double t2 = Convert.ToDouble(data["t2"]) * scale;
            double t3 = Convert.ToDouble(data["t3"]) * scale;
            double u = Convert.ToDouble(data["u"]) * scale;
            double v = Convert.ToDouble(data["v"]) * scale;
            double x = Convert.ToDouble(data["x"]) * scale;
            double y = Convert.ToDouble(data["y"]) * scale;
            double pi = Math.PI;
            double α = Math.Atan(7 / 24);//弧度
            string path = Convert.ToString(data["path"]);
            double ctrap = Convert.ToDouble(data["ctrap"]);

            //基准线点
            Vector2 v94 = new Vector2(0, 0);
            Vector2 v95 = new Vector2(v94.X + 2 * l1 - l1 / 5, v94.Y);
            Vector2 v1 = new Vector2(v94.X + l4 / 3, v94.Y + d11 / 2 + d11 / 6);
            Vector2 v2 = new Vector2(v1.X + r1 - r1 * Math.Sin(α), v1.Y + r1 * Math.Cos(α));
            Vector2 v3 = new Vector2(v1.X + l1, d1 / 2);
            Vector2 v4 = new Vector2(v3.X, v3.Y - 1 * scale);
            Vector2 v5 = new Vector2(v4.X + y / 3, v4.Y);
            Vector2 pp3 = new Vector2(v3.X - fun.CalDistance(v4, v5), v3.Y);
            Vector2 p3_1 = fun.Inters(pp3, new Vector2(pp3.X, pp3.Y - l1), v2, v3);//交点1
            Vector2 p3_2 = new Vector2(p3_1.X, -p3_1.Y);//交点2

            if (ctrap == 1)
            {
                //A型和U型
                //坐标
                Vector2 v6 = new Vector2(v5.X, v5.Y - 1 * scale);
                Vector2 v7 = new Vector2(v6.X + y / 3, v6.Y);
                Vector2 v8 = new Vector2(v7.X, v7.Y + 1 * scale);
                Vector2 v9 = new Vector2(v8.X + y / 3, v8.Y);
                Vector2 v10 = new Vector2(v9.X, d5 / 2);
                Vector2 v11 = new Vector2(v10.X + (u - y) * 1 / 4, v10.Y);
                Vector2 v12 = new Vector2(v11.X + (d5 - d4) * Math.Tan(30 * pi / 180), v11.Y - (d5 - d4));
                Vector2 v13 = new Vector2(v12.X, v12.Y);
                Vector2 v14 = new Vector2(v13.X + (u - y) * 1 / 4, v13.Y);
                Vector2 v15 = new Vector2(v14.X + (d5 - d4) / 2 * Math.Tan(30 * pi / 180), v14.Y + (d5 - d4) / 2);
                Vector2 v16 = new Vector2(v14.X + (d5 - d4) * Math.Tan(30 * pi / 180), v14.Y + (d5 - d4));
                Vector2 v17 = new Vector2(v16.X + (u - y) * 1 / 4, v16.Y);
                Vector2 v18 = new Vector2(v17.X, v17.Y - (d5 / 2 - (d5 - d3)));
                Vector2 v21 = new Vector2(v18.X, -v18.Y);
                Vector2 v23 = new Vector2(v17.X, -v17.Y);
                Vector2 v22 = new Vector2(v21.X, v21.Y - fun.CalDistance(v21, v23) / 3);
                Vector2 v24 = new Vector2(v16.X, -v16.Y);
                Vector2 v25 = new Vector2(v14.X, -v14.Y);
                Vector2 v26 = new Vector2(v13.X, -v13.Y);
                Vector2 v27 = new Vector2(v11.X, -v11.Y);
                Vector2 v28 = new Vector2(v10.X, -v10.Y);
                Vector2 v29 = new Vector2(v9.X, -v9.Y);
                Vector2 v30 = new Vector2(v8.X, -v8.Y);
                Vector2 v31 = new Vector2(v7.X, -v7.Y);
                Vector2 v32 = new Vector2(v6.X, -v6.Y);
                Vector2 v33 = new Vector2(v5.X, -v5.Y);
                Vector2 v34 = new Vector2(v4.X, -v4.Y);
                Vector2 v35 = new Vector2(v3.X, -v3.Y);
                Vector2 v37 = new Vector2(v2.X, -v2.Y);
                Vector2 v38 = new Vector2(v1.X, -v1.Y);
                Vector2 v49 = new Vector2(v1.X, d11 / 2);
                Vector2 v39 = new Vector2(v49.X, -v49.Y);
                Vector2 v40 = new Vector2(v49.X + Math.Cos(45 * pi / 180) * r2, d2 / 2);
                Vector2 v41 = new Vector2(v40.X + (l4 - Math.Cos(45 * pi / 180) * r2), v40.Y);
                Vector2 v42 = fun.Polar(v41, -45 * pi / 180, r2);
                Vector2 v98 = new Vector2(v41.X + (l2 - l4), v42.Y);
                Vector2 v43 = new Vector2(v1.X + l3, v42.Y);
                Vector2 v44 = new Vector2(v43.X + v43.Y / 2, v94.Y);
                Vector2 v45 = new Vector2(v43.X, -v43.Y);
                Vector2 v46 = new Vector2(v42.X, -v42.Y);
                Vector2 v47 = new Vector2(v41.X, -v41.Y);
                Vector2 v48 = new Vector2(v40.X, -v40.Y);
                Vector2 v36 = fun.Polar(v35, ((180 - Math.Atan((v3.Y - v2.Y) / (v3.X - v2.X)) * 180 / pi)) * pi / 180, l1 * 1 / 4 / Math.Cos(α));
                Vector2 v50 = new Vector2(v36.X, -v36.Y);
                Vector2 v51 = new Vector2(v50.X, v50.Y - d1 * 1 / 8);
                Vector2 v52 = fun.Polar(v51, -70 * pi / 180, fun.CalDistance(v43, v44) * 2 / 3);
                Vector2 v53 = fun.Polar(v52, -60 * pi / 180, fun.CalDistance(v43, v44) * 1 / 3);
                Vector2 v54 = new Vector2(v53.X, -v53.Y);
                Vector2 v55 = new Vector2(v52.X, -v52.Y);
                Vector2 v56 = new Vector2(v51.X, -v51.Y);
                Vector2 v96 = new Vector2(v13.X + fun.CalDistance(v13, v14) / 2, v13.Y + (d5 / 2 - d4 / 2) * 4);
                Vector2 v97 = new Vector2(v96.X, v27.Y - (d5 / 2 - d4 / 2) * 4);
                Vector2 v57_1 = new Vector2(v13.X - Math.Sin(30 * pi / 180) * fun.CalDistance(v11, v13) / 2, v13.Y + fun.CalDistance(v13, v14) / 2 / Math.Tan(30 * pi / 180));
                Vector2 v57_2 = new Vector2(v14.X + Math.Sin(30 * pi / 180) * fun.CalDistance(v11, v13) / 2, v14.Y + fun.CalDistance(v13, v14) / 2 / Math.Tan(30 * pi / 180));//切点
                Vector2 v57 = new Vector2(v96.X, v57_1.Y + fun.CalDistance(v57_1, v57_2) / 2 / Math.Tan(60 * pi / 180));
                Vector2 v58 = new Vector2(v57.X, v94.Y);
                Vector2 v59 = new Vector2(v57.X, -v57.Y);
                Vector2 bu1 = new Vector2(v18.X, v17.Y - (v17.Y - v14.Y) * 2);
                Vector2 bu1_1 = new Vector2(bu1.X + e / 3, bu1.Y);
                Vector2 bu2 = new Vector2(bu1.X, -bu1.Y);
                Vector2 bu2_1 = new Vector2(bu1_1.X, -bu1_1.Y);
                Vector2 bu3 = new Vector2(bu1_1.X, bu1_1.Y - fun.CalAngle(bu1_1, bu2_1) / 3);
                Vector2 bu4 = fun.Polar(bu3, -105 * pi / 180, fun.CalAngle(bu1_1, bu2_1) / 5);
                Vector2 bu5 = new Vector2(bu4.X - fun.CalAngle(bu1_1, bu2_1) / 8, v94.Y);
                Vector2 bu6 = new Vector2(bu3.X, -bu3.Y);
                Vector2 bu7 = new Vector2(bu4.X, -bu4.Y);

                //作图
                LwPolyline Arc1 = new LwPolyline();
                Arc1.Vertexes.Add(new LwPolylineVertex(v1));
                Arc1.Vertexes.Add(new LwPolylineVertex(v2));//0
                Arc1.Vertexes[0].Bulge = -Math.Tan((90 - (Math.Atan(7 / 24) * 180 / pi)) * pi / 180 / 4);
                fun.PolyFill(dxf, Arc1, 0.3, contour);

                Vector2[] Line2 = { v2, v3 };
                fun.drawBLine(dxf, Line2, 0.3, contour);

                LwPolyline poly1 = new LwPolyline();
                poly1.Vertexes.Add(new LwPolylineVertex(v3));
                poly1.Vertexes.Add(new LwPolylineVertex(v4));
                poly1.Vertexes.Add(new LwPolylineVertex(v5));
                poly1.Vertexes.Add(new LwPolylineVertex(v6));
                poly1.Vertexes.Add(new LwPolylineVertex(v7));
                poly1.Vertexes.Add(new LwPolylineVertex(v8));
                poly1.Vertexes.Add(new LwPolylineVertex(v9));
                poly1.Vertexes.Add(new LwPolylineVertex(v10));
                poly1.Vertexes.Add(new LwPolylineVertex(v11));
                poly1.Vertexes.Add(new LwPolylineVertex(v12));
                poly1.Vertexes.Add(new LwPolylineVertex(v13));
                poly1.Vertexes.Add(new LwPolylineVertex(v14));
                poly1.Vertexes.Add(new LwPolylineVertex(v16));
                poly1.Vertexes.Add(new LwPolylineVertex(v17));
                poly1.Vertexes.Add(new LwPolylineVertex(v18));
                fun.PolyFill(dxf, poly1, 0.3, contour);

                LwPolyline Arc2 = new LwPolyline();
                Arc2.Vertexes.Add(new LwPolylineVertex(v18));
                Arc2.Vertexes.Add(new LwPolylineVertex(v21));//0
                Arc2.Vertexes[0].Bulge = -Math.Tan(30 * pi / 180 / 4);
                fun.PolyFill(dxf, Arc2, 0.3, contour);

                LwPolyline poly2 = new LwPolyline();
                poly2.Vertexes.Add(new LwPolylineVertex(v21));
                poly2.Vertexes.Add(new LwPolylineVertex(v23));
                poly2.Vertexes.Add(new LwPolylineVertex(v24));
                poly2.Vertexes.Add(new LwPolylineVertex(v25));
                poly2.Vertexes.Add(new LwPolylineVertex(v26));
                poly2.Vertexes.Add(new LwPolylineVertex(v27));
                poly2.Vertexes.Add(new LwPolylineVertex(v28));
                poly2.Vertexes.Add(new LwPolylineVertex(v29));
                poly2.Vertexes.Add(new LwPolylineVertex(v30));
                poly2.Vertexes.Add(new LwPolylineVertex(v31));
                poly2.Vertexes.Add(new LwPolylineVertex(v32));
                poly2.Vertexes.Add(new LwPolylineVertex(v33));
                poly2.Vertexes.Add(new LwPolylineVertex(v34));
                poly2.Vertexes.Add(new LwPolylineVertex(v35));
                poly2.Vertexes.Add(new LwPolylineVertex(v37));
                poly2.Vertexes.Add(new LwPolylineVertex(v38));//14
                poly2.Vertexes.Add(new LwPolylineVertex(v1));
                poly2.Vertexes[14].Bulge = -Math.Tan((90 - (Math.Atan(7 / 24) * 180 / pi)) * pi / 180 / 4);
                fun.PolyFill(dxf, poly2, 0.3, contour);

                LwPolyline poly3 = new LwPolyline();
                poly3.Vertexes.Add(new LwPolylineVertex(v49));
                poly3.Vertexes.Add(new LwPolylineVertex(v40));
                poly3.Vertexes.Add(new LwPolylineVertex(v41));
                poly3.Vertexes.Add(new LwPolylineVertex(v42));
                poly3.Vertexes.Add(new LwPolylineVertex(v43));
                poly3.Vertexes.Add(new LwPolylineVertex(v44));
                poly3.Vertexes.Add(new LwPolylineVertex(v45));
                poly3.Vertexes.Add(new LwPolylineVertex(v46));
                poly3.Vertexes.Add(new LwPolylineVertex(v47));
                poly3.Vertexes.Add(new LwPolylineVertex(v48));
                poly3.Vertexes.Add(new LwPolylineVertex(v39));
                fun.PolyFill(dxf, poly3, 0.3, contour);

                Vector2[] Line3 = { v40, v48 };
                fun.drawBLine(dxf, Line3, 0.3, contour);

                Vector2[] Line4 = { v41, v47 };
                fun.drawBLine(dxf, Line4, 0.3, contour);

                Vector2[] Line5 = { v42, v46 };
                fun.drawBLine(dxf, Line5, 0.3, contour);

                Vector2[] Line6 = { v43, v45 };
                fun.drawBLine(dxf, Line6, 0.3, contour);

                Vector2[] Line7 = { v4, v34 };
                fun.drawBLine(dxf, Line7, 0.3, contour);

                Vector2[] Line8 = { v6, v32 };
                fun.drawBLine(dxf, Line8, 0.3, contour);

                Vector2[] Line9 = { v7, v31 };
                fun.drawBLine(dxf, Line9, 0.3, contour);

                Vector2[] Line10 = { v9, v29 };
                fun.drawBLine(dxf, Line10, 0.3, contour);

                Vector2 p1 = new Vector2(v18.X - l1, v18.Y);
                Vector2 v65 = fun.Inters(v9, v29, v18, p1);
                Vector2[] Line11 = { v18, v65 };
                fun.drawBLine(dxf, Line11, 0.3, contour);
                Line line11 = new Line(v18, v65);

                Vector2 p2 = new Vector2(v13.X, v13.Y - l1);
                Vector2 v62 = fun.Inters(v18, v65, v13, p2);
                Vector2[] Line12 = { v13, v62 };
                fun.drawBLine(dxf, Line12, 0.3, contour);

                Vector2 p3 = new Vector2(v14.X, v14.Y - l1);
                Vector2 v61 = fun.Inters(v18, v65, v14, p3);
                Vector2[] Line13 = { v14, v61 };
                fun.drawBLine(dxf, Line13, 0.3, contour);

                Vector2 p4 = new Vector2(v15.X, v15.Y - l1);
                Vector2 v60 = fun.Inters(v18, v65, v15, p4);
                Vector2[] Line14 = { v15, v60 };
                fun.drawBLine(dxf, Line14, 0.3, contour);

                Vector2 v63 = new Vector2(v62.X - (v13.X - v11.X) / 2, v62.Y);
                Vector2 p5 = new Vector2(v63.X, v63.Y + l1);
                Vector2 p6 = fun.Inters(v11, v13, v63, p5);
                Vector2[] Line15 = { p6, v63 };
                fun.drawBLine(dxf, Line15, 0.3, contour);

                Line Line16 = fun.mirrorline(line11, v94, v95);//镜像
                Vector2[] lsline1 = { new Vector2(Line16.StartPoint.X, Line16.StartPoint.Y), new Vector2(Line16.EndPoint.X, Line16.EndPoint.Y) };
                fun.drawBLine(dxf, lsline1, 0.3, contour);

                double a;
                Vector2 v66 = new Vector2(v65.X, v65.Y - d3 / 25);
                Vector2 v66_1 = new Vector2(v66.X + l1, v66.Y);
                a = fun.CalDistance(v18, v21);
                double arc_angle = 90 - Math.Acos(a / 2 / 30) * 180 / pi;
                Vector2 circen = new Vector2(v18.X - v18.Y / Math.Tan(arc_angle * pi / 180), v94.Y);
                Arc arc2 = new Arc(circen, 30, 360 - arc_angle, arc_angle);
                //Vector2 p01 = new Vector2(arc2.Center.X, Arc2.Center.Y);
                //dxf.AddEntity(arc2);
                Vector2 p7 = fun.getPointForArcandLine(v66, fun.Polar(v66, 0 * pi / 180, 1), circen, arc2);
                Vector2[] Line17 = { v66, p7 };
                fun.drawBLine(dxf, Line17, 0.3, contour);//线与弧交



                Vector2 v22_1 = new Vector2(v22.X - l1, v22.Y);
                Vector2 v81 = fun.Inters(v22, v22_1, v10, v28);
                Vector2[] Line18 = { v22, v81 };
                fun.drawBLine(dxf, Line18, 0.3, contour);

                Vector2 v71 = fun.Inters(v13, v26, v21, new Vector2(v21.X - l1, v21.Y));
                Vector2 v78 = fun.Inters(v13, v26, v22, v81);
                Vector2[] Line19 = { v71, v78 };
                fun.drawBLine(dxf, Line19, 0.3, contour);

                Vector2 v72 = fun.Inters(v14, v25, v21, new Vector2(v21.X - l1, v21.Y));
                Vector2 v77 = fun.Inters(v14, v25, v22, v81);
                Vector2[] Line20 = { v72, v77 };
                fun.drawBLine(dxf, Line20, 0.3, contour);

                //Circle Circle1 = new Circle(v58, d12 / 2);
                fun.drawcircle(dxf, v58, d12 / 2, 0.3, contour);

                LwPolyline poly4 = new LwPolyline();
                poly4.Vertexes.Add(new LwPolylineVertex(v50));
                poly4.Vertexes.Add(new LwPolylineVertex(v51));//0
                poly4.Vertexes.Add(new LwPolylineVertex(v52));//1
                poly4.Vertexes.Add(new LwPolylineVertex(v53));//2
                poly4.Vertexes.Add(new LwPolylineVertex(v54));//3
                poly4.Vertexes.Add(new LwPolylineVertex(v55));//4
                poly4.Vertexes.Add(new LwPolylineVertex(v56));//5
                poly4.Vertexes.Add(new LwPolylineVertex(v36));//6
                poly4.Vertexes[1].Bulge = Math.Tan(10 * pi / 180);
                poly4.Vertexes[2].Bulge = -Math.Tan(10 * pi / 180);
                poly4.Vertexes[3].Bulge = -Math.Tan(5 * pi / 180);
                poly4.Vertexes[4].Bulge = -Math.Tan(10 * pi / 180);
                poly4.Vertexes[5].Bulge = Math.Tan(10 * pi / 180);
                fun.PolyFill(dxf, poly4, 0.1, additionalline);

                fun.drawcircle(dxf, v57, fun.CalDistance(v57_1, v57), 0.3, contour);
                fun.drawcircle(dxf, v59, fun.CalDistance(v57_1, v57), 0.3, contour);

                //Vector2 v82=new Vector2 ()
                //Circle circle2 = new Circle(v57, fun.CalDistance(v57_1, v57));
                //Circle circle3 = fun.mirrorcircle(circle2, v94, v95);
                // Vector2 vghgh= new Vector2(circle3.Center.X, circle3.Center.Y);
                // fun.drawcircle(dxf, vghgh, fun.CalDistance(v57_1, v57), 0.3, contour);

                Line line17 = new Line(v66, p7);
                Line Line21 = fun.mirrorline(line17, v94, v95);//镜像
                Vector2[] lsline2 = { new Vector2(Line21.StartPoint.X, Line21.StartPoint.Y), new Vector2(Line21.EndPoint.X, Line21.EndPoint.Y) };
                fun.drawBLine(dxf, lsline2, 0.3, contour);

                Vector2 v68 = fun.Inters(v21, new Vector2(v21.X - l1, v21.Y), v10, v28);
                Vector2 v70 = fun.Inters(v63, new Vector2(v63.X, v63.Y - l1), v21, v68);
                Vector2 v79 = fun.Inters(v22, v81, v70, new Vector2(v70.X, v70.Y - l1));
                Vector2 v73 = fun.Inters(v60, new Vector2(v60.X, v60.Y - l1), v21, v68);
                Vector2 v76 = fun.Inters(v60, new Vector2(v73.X, v73.Y - l1), v22, v81);
                Vector2[] Line22 = { v70, v79 };
                fun.drawBLine(dxf, Line22, 0.3, contour);
                Vector2[] Line23 = { v73, v76 };
                fun.drawBLine(dxf, Line23, 0.3, contour);

                Vector2 v82 = new Vector2(v28.X, v28.Y + fun.CalDistance(v22, v23) / 2);
                Vector2 v93 = fun.Polar(v27, 60 * pi / 180, fun.CalDistance(v27, v26) * 1 / 3);
                Vector2 v84 = fun.Inters(v82, new Vector2(v82.X + l1, v82.Y), v93, new Vector2(v93.X, v93.Y + l1));
                Vector2 v86 = fun.Polar(v84, 60 * pi / 180, fun.CalDistance(v27, v26) * 2 / 3);
                Vector2 v87 = fun.Inters(v86, new Vector2(v86.X + l1, v86.Y), v96, v97);
                Vector2 v88 = new Vector2(v87.X + fun.CalDistance(v86, v87), v87.Y);
                Vector2 v90 = fun.Polar(v88, -60 * pi / 180, fun.CalDistance(v27, v26) * 2 / 3);
                Vector2 v92 = new Vector2(v23.X, v23.Y + fun.CalDistance(v22, v23) / 2);

                LwPolyline poly5 = new LwPolyline();
                poly5.Vertexes.Add(new LwPolylineVertex(v82));
                poly5.Vertexes.Add(new LwPolylineVertex(v84));//0
                poly5.Vertexes.Add(new LwPolylineVertex(v86));//1
                poly5.Vertexes.Add(new LwPolylineVertex(v87));//2
                poly5.Vertexes.Add(new LwPolylineVertex(v88));
                poly5.Vertexes.Add(new LwPolylineVertex(v90));
                poly5.Vertexes.Add(new LwPolylineVertex(v92));
                fun.PolyFill(dxf, poly5, 0.1, additionalline);

                Line Line25 = new Line(v94, v95);
                Line25.Lineweight = Lineweight.W25;
                Line25.Layer = centre;
                Line25.Linetype = Linetype.Center;
                dxf.AddEntity(Line25);

                Line Line26 = new Line(v96, v97);
                Line26.Lineweight = Lineweight.W25;
                Line26.Layer = centre;
                Line26.Linetype = Linetype.Center;
                dxf.AddEntity(Line26);

                Vector2[] Line27 = { v86, v26 };
                fun.drawBLine(dxf, Line27, 0.1, additionalline);
                Vector2[] Line28 = { v88, v25 };
                fun.drawBLine(dxf, Line28, 0.1, additionalline);
                Vector2[] Line29 = { v93, v84 };
                fun.drawBLine(dxf, Line29, 0.1, additionalline);

                Line line29 = new Line(v93, v84);
                Line Line30 = fun.mirrorline(line29, v96, v97);//镜像
                Vector2[] lsline3 = { new Vector2(Line30.StartPoint.X, Line30.StartPoint.Y), new Vector2(Line30.EndPoint.X, Line30.EndPoint.Y) };
                fun.drawBLine(dxf, lsline3, 0.1, additionalline);

                Vector2 p8 = fun.Inters(v98, new Vector2(v98.X, v98.Y - l1), v45, v46);
                Vector2 p8_1 = fun.Inters(v41, new Vector2(v41.X + l1, v41.Y), v98, new Vector2(v98.X, v98.Y + l1));
                Vector2 p8_2 = fun.Inters(v47, new Vector2(v47.X + l1, v47.Y), v98, new Vector2(v98.X, v98.Y - l1));
                LwPolyline poly6 = new LwPolyline();
                poly6.Vertexes.Add(new LwPolylineVertex(v41));
                poly6.Vertexes.Add(new LwPolylineVertex(p8_1));
                poly6.Vertexes.Add(new LwPolylineVertex(v98));
                poly6.Linetype = Linetype.Dashed;
                poly6.Layer = refin;
                poly6.Lineweight = Lineweight.W20;
                dxf.AddEntity(poly6);

                LwPolyline poly7 = new LwPolyline();
                poly7.Vertexes.Add(new LwPolylineVertex(p8));
                poly7.Vertexes.Add(new LwPolylineVertex(p8_2));
                poly7.Vertexes.Add(new LwPolylineVertex(v47));
                poly7.Linetype = Linetype.Dashed;
                poly7.Layer = refin;
                poly7.Lineweight = Lineweight.W20;
                dxf.AddEntity(poly7);

                Vector2[] Line32 = { v98, p8 };
                fun.drawBLine(dxf, Line32, 0.1, additionalline);

                Vector2[] Line33 = { bu1, bu1_1 };
                fun.drawBLine(dxf, Line33, 0.3, contour);
                Vector2[] Line34 = { bu2, bu2_1 };
                fun.drawBLine(dxf, Line34, 0.3, contour);

                LwPolyline poly8 = new LwPolyline();
                poly8.Vertexes.Add(new LwPolylineVertex(bu1_1));
                poly8.Vertexes.Add(new LwPolylineVertex(bu3));//0
                poly8.Vertexes.Add(new LwPolylineVertex(bu4));//1
                poly8.Vertexes.Add(new LwPolylineVertex(bu5));//2
                poly8.Vertexes.Add(new LwPolylineVertex(bu7));//3
                poly8.Vertexes.Add(new LwPolylineVertex(bu6));//4
                poly8.Vertexes.Add(new LwPolylineVertex(bu2_1));//5
                                                                //poly8.Vertexes[4].Bulge = Math.Tan(10 * pi / 180);
                fun.PolyFill(dxf, poly8, 0.1, additionalline);

                LwPolyline hatchpoly1 = new LwPolyline();
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v50));
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v51));//0
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v52));//1
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v53));//2
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v54));//3
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v55));//4
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v56));//5
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v36));//6
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v37));//7
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v38));//8
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v39));//9
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v48));//10
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v47));//11
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v46));//12
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v45));//13
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v44));//14
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v43));//15
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v42));//16
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v41));//17
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v40));//18
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v49));//19
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v1));//20
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v2));//21
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v50));//22
                hatchpoly1.Vertexes[1].Bulge = Math.Tan(10 * pi / 180);
                hatchpoly1.Vertexes[2].Bulge = -Math.Tan(10 * pi / 180);
                hatchpoly1.Vertexes[3].Bulge = -Math.Tan(5 * pi / 180);
                hatchpoly1.Vertexes[4].Bulge = -Math.Tan(10 * pi / 180);
                hatchpoly1.Vertexes[5].Bulge = Math.Tan(10 * pi / 180);
                hatchpoly1.Vertexes[8].Bulge = -Math.Tan((90 - (Math.Atan(7 / 24) * 180 / pi)) * pi / 180 / 4);
                hatchpoly1.Vertexes[21].Bulge = -Math.Tan((90 - (Math.Atan(7 / 24) * 180 / pi)) * pi / 180 / 4);
                hatchpoly1.IsClosed = true;
                String[] htype1 = new String[100];
                Line[] hline1 = new Line[100];
                Arc[] harc1 = new Arc[100];
                int hnumst1 = hatchpoly1.Explode().Count;  //记录爆炸后，线段有多少
                for (int i = 0; i < hnumst1; i++)
                {
                    htype1[i] = hatchpoly1.Explode()[i].Type.ToString();    //将所有的元素记录成一个数组
                    if (htype1[i] == "Line")
                    {
                        hline1[i] = (Line)hatchpoly1.Explode()[i];
                    }
                    if (htype1[i] == "Arc")
                    {
                        harc1[i] = (Arc)hatchpoly1.Explode()[i];
                    }
                }
                fun.hatchsub1(dxf, htype1, hnumst1, 45, 10, hline1, harc1, hatching);



                //1_1标注
                //局部放大
                Circle circle_1 = new Circle(fun.Inters(new Vector2(v13.X - l1, v13.Y), v13, v63, new Vector2(v63.X, v63.Y + l1)), e / 3);
                circle_1.Layer = dimensioning;
                circle_1.Lineweight = Lineweight.W20;
                dxf.AddEntity(circle_1);

                Vector2 circle_1_1 = fun.Polar(fun.Inters(new Vector2(v13.X - l1, v13.Y), v13, v63, new Vector2(v63.X, v63.Y + l1)), 65 * pi / 180, e / 3);
                Vector2 circle_1_2 = fun.Polar(circle_1_1, 45 * pi / 180, e);
                Line line1 = new Line(circle_1_1, circle_1_2);
                dxf.AddEntity(line1);
                Text text_circle_1 = new Text("A", fun.Polar(circle_1_2, 15 * pi / 180, 1), 2, 0);
                dxf.AddEntity(text_circle_1);

                Circle circle_2 = new Circle(fun.Inters(v94, v95, v49, v38), d1 / 2);
                circle_2.Layer = dimensioning;
                circle_2.Lineweight = Lineweight.W20;
                dxf.AddEntity(circle_2);

                Vector2 circle_2_1 = fun.Polar(fun.Inters(v94, v95, v49, v38), 125 * pi / 180, d1 / 2);
                Vector2 circle_2_2 = fun.Polar(circle_2_1, 115 * pi / 180, d1 / 2);
                Line line2 = new Line(circle_2_1, circle_2_2);
                dxf.AddEntity(line2);
                Text text_circle_2 = new Text("B", fun.Polar(circle_2_2, 165 * pi / 180, 1), 2, 0);
                dxf.AddEntity(text_circle_2);

                //锥度
                Vector2 p36 = fun.Polar(v35, ((180 - Math.Atan((v3.Y - v2.Y) / (v3.X - v2.X)) * 180 / pi)) * pi / 180, l1 * 1 / 3 / Math.Cos(α));
                fun.jtbz(dxf, p36, -90, 20, 1, "7:24", 2, 2);

                //1_2
                //点
                Vector2 v98_1 = new Vector2(v95.X + l1, v95.Y);
                Vector2 v99 = new Vector2(v98_1.X + l5 * 4, v98_1.Y);
                Vector2 v102 = new Vector2(v98_1.X + fun.CalDistance(v98_1, v99) / 2, v98_1.Y);
                Vector2 v100 = new Vector2(v102.X, v102.Y + fun.CalDistance(v98_1, v99) / 2);
                Vector2 v101 = new Vector2(v102.X, v102.Y - fun.CalDistance(v98_1, v99) / 2);
                Vector2 v103 = new Vector2(v102.X - Math.Tan(Math.Acos(b / 2 / (d5 / 2))) * b / 2, v102.Y + b / 2);
                Vector2 v105 = new Vector2(v102.X - l5, v103.Y - l7);
                Vector2 v104 = new Vector2(v105.X - l7, v103.Y);
                Vector2 v110 = new Vector2(v103.X, -v103.Y);
                Vector2 v106 = new Vector2(v105.X, -v105.Y);
                Vector2 v107 = new Vector2(v104.X, -v104.Y);
                Vector2 v118 = new Vector2(v102.X + Math.Tan(Math.Acos(b / 2 / (d5 / 2))) * b / 2, v102.Y + b / 2);
                Vector2 v115 = new Vector2(v102.X + l6, v118.Y - l7);
                Vector2 v116 = new Vector2(v115.X + l7, v115.Y + l7);
                Vector2 v111 = new Vector2(v118.X, -v118.Y);
                Vector2 v113 = new Vector2(v116.X, -v116.Y);
                Vector2 v114 = new Vector2(v115.X, -v115.Y);

                Arc arc1_2_1 = new Arc(v102, fun.CalDistance(v102, v103), 0, -90);
                Vector2 v113_1 = fun.getPointForArcandLine(v113, new Vector2(v113.X, v113.Y - l1), v102, arc1_2_1);
                Vector2 v113_3 = fun.mirrorpoint(v113_1, v102, fun.Polar(v102, -45 * pi / 180, 10));
                Vector2 v113_2 = new Vector2(v102.X + j, v113_1.Y);

                //作图
                fun.drawcircle(dxf, v102, fun.CalDistance(v42, v46) / 2, 0.3, contour);
                fun.drawcircle(dxf, v102, fun.CalDistance(v41, v47) / 2, 0.01, contour);
                fun.drawcircle(dxf, v102, fun.CalDistance(v49, v39) / 2, 0.01, contour);
                fun.drawcircle(dxf, v102, l5, 0.3, contour);
                fun.drawcircle(dxf, v102, fun.CalDistance(v2, v37) / 2, 0.3, contour);

                LwPolyline ddx1 = new LwPolyline();
                ddx1.Vertexes.Add(new LwPolylineVertex(v103));
                ddx1.Vertexes.Add(new LwPolylineVertex(v104));//0
                ddx1.Vertexes.Add(new LwPolylineVertex(v105));//1
                ddx1.Vertexes.Add(new LwPolylineVertex(v106));//2
                ddx1.Vertexes.Add(new LwPolylineVertex(v107));//3
                ddx1.Vertexes.Add(new LwPolylineVertex(v110));//4
                ddx1.Vertexes.Add(new LwPolylineVertex(v111));//5
                ddx1.Vertexes.Add(new LwPolylineVertex(v113));//6
                ddx1.Vertexes.Add(new LwPolylineVertex(v114));//7
                ddx1.Vertexes.Add(new LwPolylineVertex(v115));//8
                ddx1.Vertexes.Add(new LwPolylineVertex(v116));//9
                ddx1.Vertexes.Add(new LwPolylineVertex(v118));//10
                ddx1.Vertexes.Add(new LwPolylineVertex(v103));//11
                ddx1.Vertexes[1].Bulge = -Math.Tan(90 * pi / 180 / 4);
                ddx1.Vertexes[3].Bulge = -Math.Tan(90 * pi / 180 / 4);
                ddx1.Vertexes[5].Bulge = Math.Tan(Math.Acos(b / 2 / (d5 / 2)) * 2 / 4);
                ddx1.Vertexes[7].Bulge = -Math.Tan(90 * pi / 180 / 4);
                ddx1.Vertexes[9].Bulge = -Math.Tan(90 * pi / 180 / 4);
                ddx1.Vertexes[11].Bulge = Math.Tan(Math.Acos(b / 2 / (d5 / 2)) * 2 / 4);
                fun.PolyFill(dxf, ddx1, 0.3, contour);

                Line centreline1_2_1 = new Line(v98_1, v99);
                centreline1_2_1.Linetype = Linetype.Center;
                centreline1_2_1.Lineweight = Lineweight.W25;
                centreline1_2_1.Layer = centre;
                dxf.AddEntity(centreline1_2_1);

                Line centreline1_2_2 = new Line(v100, v101);
                centreline1_2_2.Linetype = Linetype.Center;
                centreline1_2_2.Lineweight = Lineweight.W25;
                centreline1_2_2.Layer = centre;
                dxf.AddEntity(centreline1_2_2);

                LwPolyline ddx3 = new LwPolyline();
                ddx3.Vertexes.Add(new LwPolylineVertex(v113_1));
                ddx3.Vertexes.Add(new LwPolylineVertex(v113_2));//0
                ddx3.Vertexes.Add(new LwPolylineVertex(v113_3));//1
                fun.PolyFill(dxf, ddx3, 0.3, contour);

                //1_3部分点
                Vector2 v118_1 = new Vector2(v94.X + fun.CalDistance(v94, v95) / 2, v94.Y - l1 * 2);
                Vector2 v3_1 = fun.Polar(v118_1, -135 * pi / 180, fun.CalDistance(v96, v3) * 2);
                Vector2 v4_1 = new Vector2(v3_1.X, v3_1.Y - 1 * scale * 2);
                Vector2 v5_1 = new Vector2(v4_1.X + y / 3 * 2, v4_1.Y);
                Vector2 v6_1 = new Vector2(v5_1.X, v5_1.Y - 1 * scale * 2);
                Vector2 v7_1 = new Vector2(v6_1.X + y / 3 * 2, v6_1.Y);
                Vector2 v8_1 = new Vector2(v7_1.X, v7_1.Y + 1 * scale * 2);
                Vector2 v9_1 = new Vector2(v8_1.X + y / 3 * 2, v8_1.Y);
                Vector2 v10_1 = new Vector2(v9_1.X, v9_1.Y + fun.CalDistance(v9, v10) * 2);
                Vector2 v11_1 = new Vector2(v10_1.X + (u - y) * 1 / 4 * 2, v10_1.Y);
                Vector2 v12_1 = new Vector2(v11_1.X + (d5 - d4) * Math.Tan(30 * pi / 180) * 2, v11_1.Y - (d5 - d4) * 2);
                Vector2 v13_1 = new Vector2(v12_1.X, v12_1.Y);
                Vector2 v14_1 = new Vector2(v13_1.X + (u - y) * 1 / 4 * 2, v13_1.Y);
                Vector2 v15_1 = new Vector2(v14_1.X + (d5 - d4) / 2 * Math.Tan(30 * pi / 180) * 2, v14_1.Y + (d5 - d4) / 2 * 2);
                Vector2 v16_1 = new Vector2(v14_1.X + (d5 - d4) * Math.Tan(30 * pi / 180) * 2, v14_1.Y + (d5 - d4) * 2);
                Vector2 v17_1 = new Vector2(v16_1.X + (u - y) * 1 / 4 * 2, v16_1.Y);
                Vector2 bu1_2 = new Vector2(v17_1.X, v17_1.Y - fun.CalDistance(v17, bu1) * 2);
                Vector2 v118_2 = new Vector2(v13_1.X + fun.CalDistance(v13_1, v14_1) / 2, v13_1.Y + (d6 - d5) / 2 * 6);
                Vector2 v119 = new Vector2(v118_2.X, v118_2.Y - fun.CalDistance(v96, v97) / 1.3);
                Vector2 v120 = fun.Polar(v3_1, -(pi / 2 + (pi / 2 - fun.CalAngle(v2, v3))), fun.CalDistance(v2, v3) / 4);
                Vector2 v121 = new Vector2(bu1_2.X + fun.CalDistance(v17_1, bu1_2), bu1_2.Y);
                Vector2 v122 = new Vector2(v4_1.X, v4_1.Y - fun.CalDistance(v3_1, v4_1) * 4);
                Vector2 v123 = new Vector2(v6_1.X, v6_1.Y - fun.CalDistance(v5_1, v6_1) * 4.5);
                Vector2 v124 = new Vector2(v7_1.X, v7_1.Y - fun.CalDistance(v7_1, v8_1) * 5);
                Vector2 v125 = new Vector2(v9_1.X, v9_1.Y - fun.CalDistance(v7_1, v8_1) * 4.5);
                Vector2 p5_1 = fun.Polar(v11_1, -60 * pi / 180, fun.CalDistance(v11_1, v13_1) / 2);
                Vector2 v126 = new Vector2(p5_1.X, p5_1.Y - fun.CalDistance(v11_1, v13_1) * 2 + 5 * scale);
                Vector2 v127 = new Vector2(v13_1.X, v13_1.Y - fun.CalDistance(v13, v62) * 2 / 3 * 2);
                Vector2 v128 = new Vector2(v14_1.X, v14_1.Y - fun.CalDistance(v13, v62) * 2 / 3 * 2 - 1 * scale);
                Vector2 v129 = new Vector2(v15_1.X, v15_1.Y - fun.CalDistance(v13, v62) * 2 / 3 * 2 - 2 * scale);
                Vector2 v130 = new Vector2(bu1_2.X, bu1_2.Y - fun.CalDistance(v17_1, bu1_2) / 4);
                Vector2 v57_2_1 = new Vector2(v13_1.X - Math.Sin(30 * pi / 180) * fun.CalDistance(v11_1, v13_1) / 2, v13_1.Y + fun.CalDistance(v13_1, v14_1) / 2 / Math.Tan(30 * pi / 180));
                Vector2 v57_2_2 = new Vector2(v14_1.X + Math.Sin(30 * pi / 180) * fun.CalDistance(v11_1, v13_1) / 2, v14_1.Y + fun.CalDistance(v13_1, v14_1) / 2 / Math.Tan(30 * pi / 180));//切点
                Vector2 v57_2a = new Vector2(v118_2.X, v57_2_1.Y + fun.CalDistance(v57_2_1, v57_2_2) / 2 / Math.Tan(60 * pi / 180));

                /*Vector2[] a1 = { v57_2_2, v57_2a };
                for (int i1 = 0; i1 < a1.Length; i1++)
                {
                    a1[i1].X = a1[i1].X+12;
                    a1[i1].Y = 12;

                }*/
                LwPolyline ddx_1_3_1 = new LwPolyline();
                ddx_1_3_1.Vertexes.Add(new LwPolylineVertex(v120));
                ddx_1_3_1.Vertexes.Add(new LwPolylineVertex(v3_1));
                ddx_1_3_1.Vertexes.Add(new LwPolylineVertex(v4_1));
                ddx_1_3_1.Vertexes.Add(new LwPolylineVertex(v5_1));
                ddx_1_3_1.Vertexes.Add(new LwPolylineVertex(v6_1));
                ddx_1_3_1.Vertexes.Add(new LwPolylineVertex(v7_1));
                ddx_1_3_1.Vertexes.Add(new LwPolylineVertex(v8_1));
                ddx_1_3_1.Vertexes.Add(new LwPolylineVertex(v9_1));
                ddx_1_3_1.Vertexes.Add(new LwPolylineVertex(v10_1));
                ddx_1_3_1.Vertexes.Add(new LwPolylineVertex(v11_1));
                ddx_1_3_1.Vertexes.Add(new LwPolylineVertex(v12_1));
                ddx_1_3_1.Vertexes.Add(new LwPolylineVertex(v13_1));
                ddx_1_3_1.Vertexes.Add(new LwPolylineVertex(v14_1));
                ddx_1_3_1.Vertexes.Add(new LwPolylineVertex(v15_1));
                ddx_1_3_1.Vertexes.Add(new LwPolylineVertex(v16_1));
                ddx_1_3_1.Vertexes.Add(new LwPolylineVertex(v17_1));
                ddx_1_3_1.Vertexes.Add(new LwPolylineVertex(bu1_2));
                fun.PolyFill(dxf, ddx_1_3_1, 0.3, contour);

                Vector2[] Line1_3_1 = { v4_1, v122 };
                fun.drawBLine(dxf, Line1_3_1, 0.3, contour);

                Vector2[] Line1_3_2 = { v6_1, v123 };
                fun.drawBLine(dxf, Line1_3_2, 0.3, contour);

                Vector2[] Line1_3_3 = { v7_1, v124 };
                fun.drawBLine(dxf, Line1_3_3, 0.3, contour);

                Vector2[] Line1_3_4 = { v9_1, v125 };
                fun.drawBLine(dxf, Line1_3_4, 0.3, contour);

                Vector2[] Line1_3_5 = { p5_1, v126 };
                fun.drawBLine(dxf, Line1_3_5, 0.3, contour);

                Vector2[] Line1_3_6 = { v13_1, v127 };
                fun.drawBLine(dxf, Line1_3_6, 0.3, contour);

                Vector2[] Line1_3_7 = { v14_1, v128 };
                fun.drawBLine(dxf, Line1_3_7, 0.3, contour);

                Vector2[] Line1_3_8 = { v15_1, v129 };
                fun.drawBLine(dxf, Line1_3_8, 0.3, contour);

                Vector2[] Line1_3_9 = { bu1_2, v130 };
                fun.drawBLine(dxf, Line1_3_9, 0.3, contour);

                Vector2[] Line1_3_10 = { bu1_2, v121 };
                fun.drawBLine(dxf, Line1_3_10, 0.3, contour);

                LwPolyline ddx_1_3_2 = new LwPolyline();
                ddx_1_3_2.Vertexes.Add(new LwPolylineVertex(v120));
                ddx_1_3_2.Vertexes.Add(new LwPolylineVertex(v122));//0
                ddx_1_3_2.Vertexes.Add(new LwPolylineVertex(v123));//1
                ddx_1_3_2.Vertexes.Add(new LwPolylineVertex(v124));//2
                ddx_1_3_2.Vertexes.Add(new LwPolylineVertex(v125));//3
                ddx_1_3_2.Vertexes.Add(new LwPolylineVertex(v126));//4
                ddx_1_3_2.Vertexes.Add(new LwPolylineVertex(v127));//5
                ddx_1_3_2.Vertexes.Add(new LwPolylineVertex(v119));//6
                ddx_1_3_2.Vertexes.Add(new LwPolylineVertex(v128));//7
                ddx_1_3_2.Vertexes.Add(new LwPolylineVertex(v129));//8
                ddx_1_3_2.Vertexes.Add(new LwPolylineVertex(v130));//9
                ddx_1_3_2.Vertexes.Add(new LwPolylineVertex(v121));//10
                ddx_1_3_2.Vertexes[0].Bulge = Math.Tan(60 * pi / 180 / 4);
                ddx_1_3_2.Vertexes[1].Bulge = Math.Tan(20 * pi / 180 / 4);
                ddx_1_3_2.Vertexes[2].Bulge = Math.Tan(20 * pi / 180 / 4);
                ddx_1_3_2.Vertexes[3].Bulge = Math.Tan(20 * pi / 180 / 4);
                ddx_1_3_2.Vertexes[4].Bulge = -Math.Tan(20 * pi / 180 / 4);
                ddx_1_3_2.Vertexes[5].Bulge = -Math.Tan(20 * pi / 180 / 4);
                ddx_1_3_2.Vertexes[6].Bulge = Math.Tan(20 * pi / 180 / 4);
                ddx_1_3_2.Vertexes[7].Bulge = Math.Tan(20 * pi / 180 / 4);
                ddx_1_3_2.Vertexes[8].Bulge = Math.Tan(20 * pi / 180 / 4);
                ddx_1_3_2.Vertexes[9].Bulge = Math.Tan(20 * pi / 180 / 4);
                ddx_1_3_2.Vertexes[10].Bulge = Math.Tan(20 * pi / 180 / 4);
                fun.PolyFill(dxf, ddx_1_3_2, 0.1, additionalline);

                Line line1_3_1 = new Line(v118_2, v119);
                line1_3_1.Layer = centre;
                line1_3_1.Linetype = Linetype.Center;
                line1_3_1.Lineweight = Lineweight.W25;
                dxf.AddEntity(line1_3_1);

                fun.drawcircle(dxf, v57_2a, fun.CalDistance(v57_2a, p5_1), 0.3, contour);

                //1_4部分点
                Vector2 v131 = new Vector2(v101.X - fun.CalDistance(v98_1, v102) / 1.5, v101.Y - fun.CalDistance(v100, v101) * 1.2);
                //Vector2 v131 = fun.Polar(v101, -115 * pi / 180, fun.CalDistance(v100, v101) * 1.5);
                Vector2 v132 = new Vector2(v131.X + fun.CalDistance(v98_1, v99), v131.Y);
                Vector2 v133 = new Vector2(v131.X + fun.CalDistance(v131, v132) / 10, v131.Y + fun.CalDistance(v131, v132) / 3);
                Vector2 v134 = new Vector2(v133.X + (r1 - r1 * Math.Sin(α)) * 2, v133.Y + r1 * Math.Cos(α) * 2);
                Vector2 v135 = new Vector2(v133.X + l1, v133.Y + (d1 / 2 - v1.Y));
                Vector2 v136 = new Vector2(v133.X, v133.Y - fun.CalDistance(v1, v49) * 2);
                Vector2 v137 = fun.Polar(v136, -45 * pi / 180, +fun.CalDistance(v49, v40) * 2);
                Vector2 v138 = new Vector2(v137.X + fun.CalDistance(v41, v40) * 2, v137.Y);
                Vector2 v139 = fun.Polar(v138, -45 * pi / 180, fun.CalDistance(v41, v42) * 2);
                Vector2 v140 = new Vector2(v139.X + fun.CalDistance(v42, v43) / 2 * 2.4, v139.Y);
                Vector2 v141 = fun.mirrorpoint(v136, v131, v132);
                Vector2 v142 = fun.mirrorpoint(v137, v131, v132);
                Vector2 v143 = fun.mirrorpoint(v138, v131, v132);
                Vector2 v144 = fun.mirrorpoint(v139, v131, v132);
                Vector2 v145 = fun.mirrorpoint(v140, v131, v132);
                Vector2 v146 = fun.mirrorpoint(v133, v131, v132);
                Vector2 v147 = fun.mirrorpoint(v134, v131, v132);
                Vector2 v148 = fun.mirrorpoint(v135, v131, v132);
                Vector2 v149 = new Vector2(v143.X + fun.CalDistance(v144, v145) * 1.1, v143.Y);
                Vector2 v150 = fun.mirrorpoint(v149, v131, v132);

                LwPolyline ddx_1_4_1 = new LwPolyline();
                ddx_1_4_1.Vertexes.Add(new LwPolylineVertex(v135));
                ddx_1_4_1.Vertexes.Add(new LwPolylineVertex(v134));//0
                ddx_1_4_1.Vertexes.Add(new LwPolylineVertex(v133));//1
                ddx_1_4_1.Vertexes.Add(new LwPolylineVertex(v146));//2
                ddx_1_4_1.Vertexes.Add(new LwPolylineVertex(v147));//3
                ddx_1_4_1.Vertexes.Add(new LwPolylineVertex(v148));//4
                ddx_1_4_1.Vertexes[1].Bulge = Math.Tan((90 - (Math.Atan(7 / 24) * 180 / pi)) * pi / 180 / 4);
                ddx_1_4_1.Vertexes[3].Bulge = Math.Tan((90 - (Math.Atan(7 / 24) * 180 / pi)) * pi / 180 / 4);
                fun.PolyFill(dxf, ddx_1_4_1, 0.3, contour);

                LwPolyline ddx_1_4_2 = new LwPolyline();
                ddx_1_4_2.Vertexes.Add(new LwPolylineVertex(v136));
                ddx_1_4_2.Vertexes.Add(new LwPolylineVertex(v137));//0
                ddx_1_4_2.Vertexes.Add(new LwPolylineVertex(v138));//1
                ddx_1_4_2.Vertexes.Add(new LwPolylineVertex(v139));//2
                ddx_1_4_2.Vertexes.Add(new LwPolylineVertex(v140));//3
                fun.PolyFill(dxf, ddx_1_4_2, 0.3, contour);

                LwPolyline ddx_1_4_3 = new LwPolyline();
                ddx_1_4_3.Vertexes.Add(new LwPolylineVertex(v141));
                ddx_1_4_3.Vertexes.Add(new LwPolylineVertex(v142));//0
                ddx_1_4_3.Vertexes.Add(new LwPolylineVertex(v143));//1
                ddx_1_4_3.Vertexes.Add(new LwPolylineVertex(v144));//2
                ddx_1_4_3.Vertexes.Add(new LwPolylineVertex(v145));//3
                fun.PolyFill(dxf, ddx_1_4_3, 0.3, contour);

                Vector2[] Line1_4_1 = { v137, v142 };
                fun.drawBLine(dxf, Line1_4_1, 0.3, contour);

                Vector2[] Line1_4_2 = { v138, v143 };
                fun.drawBLine(dxf, Line1_4_2, 0.3, contour);

                Vector2[] Line1_4_3 = { v139, v144 };
                fun.drawBLine(dxf, Line1_4_3, 0.3, contour);

                Line centreline1_4_1 = new Line(v131, v132);
                centreline1_4_1.Linetype = Linetype.Center;
                centreline1_4_1.Lineweight = Lineweight.W25;
                centreline1_4_1.Layer = centre;
                dxf.AddEntity(centreline1_4_1);

                Line centreline1_4_2 = new Line(v138, v150);
                centreline1_4_2.Linetype = Linetype.Dashed;
                centreline1_4_2.Lineweight = Lineweight.W25;
                centreline1_4_2.Layer = refin;
                centreline1_4_2.LinetypeScale = 5;
                dxf.AddEntity(centreline1_4_2);

                Line centreline1_4_3 = new Line(v143, v149);
                centreline1_4_3.Linetype = Linetype.Dashed;
                centreline1_4_3.Lineweight = Lineweight.W25;
                centreline1_4_3.Layer = refin;
                centreline1_4_3.LinetypeScale = 5;
                dxf.AddEntity(centreline1_4_3);

                LwPolyline ddx_1_4_4 = new LwPolyline();
                ddx_1_4_4.Vertexes.Add(new LwPolylineVertex(v135));
                ddx_1_4_4.Vertexes.Add(new LwPolylineVertex(v150));//0
                ddx_1_4_4.Vertexes.Add(new LwPolylineVertex(v140));//1
                ddx_1_4_4.Vertexes.Add(new LwPolylineVertex(v145));//2
                ddx_1_4_4.Vertexes.Add(new LwPolylineVertex(v149));//3
                ddx_1_4_4.Vertexes.Add(new LwPolylineVertex(v148));//4
                ddx_1_4_4.Vertexes[0].Bulge = -Math.Tan(30 * pi / 180 / 4);
                ddx_1_4_4.Vertexes[1].Bulge = Math.Tan(30 * pi / 180 / 4);
                ddx_1_4_4.Vertexes[2].Bulge = Math.Tan(30 * pi / 180 / 4);
                ddx_1_4_4.Vertexes[3].Bulge = Math.Tan(30 * pi / 180 / 4);
                ddx_1_4_4.Vertexes[4].Bulge = -Math.Tan(30 * pi / 180 / 4);
                fun.PolyFill(dxf, ddx_1_4_4, 0.1, additionalline);

                //标注样式
                //箭头样式
                DimensionStyle dimensionStyle = fun.CreateDimStyle();
                dimensionStyle.ArrowSize = 1;
                dimensionStyle.ExtLineExtend = 0.6;//标注延长线长度/2
                dimensionStyle.DimArrow1 = DimensionArrowhead.Closedfilled;
                dimensionStyle.DimArrow2 = DimensionArrowhead.Closedfilled;

                //文本样式
                dimensionStyle.TextHeight = 1;

                //线段尺寸标注
                //1_1
                LinearDimension dim1 = new LinearDimension(new Line(v1, p3_1), d6, 0, dimensionStyle);
                dim1.UserText = "l1=" + Math.Round(l1 * scale, 1);
                dxf.AddEntity(dim1);

                LinearDimension dim2 = new LinearDimension(new Line(v1, v43), d6 - d6 / 6, 0, dimensionStyle);
                dim2.UserText = "l3=" + Math.Round(l3 * scale, 1);
                dxf.AddEntity(dim2);

                LinearDimension dim3 = new LinearDimension(new Line(v1, v98), d6 - d6 / 6 * 2, 0, dimensionStyle);
                dim3.UserText = "l2=" + Math.Round(l2 * scale, 1);
                dxf.AddEntity(dim3);

                LinearDimension dim4 = new LinearDimension(new Line(v1, v41), d6 - d6 / 6 * 3, 0, dimensionStyle);
                dim4.UserText = "l4=" + Math.Round(l4 * scale, 1);
                dxf.AddEntity(dim4);

                LinearDimension dim5 = new LinearDimension(new Line(p3_1, new Vector2(bu1_1.X - fun.CalDistance(bu1, bu1_1) / 6, bu1.Y)), d6 - (bu1_1.Y - v3.Y), 0, dimensionStyle);
                dim5.UserText = "e=" + Math.Round(e * scale, 1);
                dxf.AddEntity(dim5);

                LinearDimension dim6 = new LinearDimension(new Line(p3_1, v17), d6 - d6 / 6 * 2 - (bu1_1.Y - v3.Y), 0, dimensionStyle);
                dim6.UserText = "u=" + Math.Round(u * scale, 1);
                dxf.AddEntity(dim6);

                double f = fun.CalDistance(v11, v17);
                LinearDimension dim7 = new LinearDimension(new Line(v10, v17), d6 - d6 / 6 * 3 - (v10.Y - v1.Y), 0, dimensionStyle);
                dim7.UserText = "(f)=" + Math.Round(f * scale, 1);
                dxf.AddEntity(dim7);

                LinearDimension dim8 = new LinearDimension(new Line(p3_1, v10), d6 - d6 / 6 * 4 - (v10.Y - v3.Y), 0, dimensionStyle);
                dim8.UserText = "y=" + Math.Round(y * scale, 1);
                dxf.AddEntity(dim8);

                Vector2 bz1 = new Vector2(v57.X, v57.Y + fun.CalDistance(v57, v57_1));
                LinearDimension dim9 = new LinearDimension(new Line(bz1, fun.mirrorpoint(bz1, v94, v95)), l1 * 1.4, -90, dimensionStyle);
                dim9.UserText = "φd6=" + Math.Round(d6 * scale, 1);
                dxf.AddEntity(dim9);

                LinearDimension dim10 = new LinearDimension(new Line(v17, v23), l1 * 1.3 - (v17.X - v10.X), -90, dimensionStyle);
                dim10.UserText = "φd5=" + Math.Round(d5 * scale, 1);
                dxf.AddEntity(dim10);

                LinearDimension dim11 = new LinearDimension(new Line(v14, v25), l1 * 1.2 - (v17.X - v10.X), -90, dimensionStyle);
                dim11.UserText = "φd4=" + Math.Round(d4 * scale, 1);
                dxf.AddEntity(dim11);

                LinearDimension dim12 = new LinearDimension(new Line(bu1, bu2), l1 * 0.8 - (v17.X - v10.X), -90, dimensionStyle);
                dim12.UserText = "φd3=" + Math.Round(d3 * scale, 1);
                dxf.AddEntity(dim12);

                LinearDimension dim23 = new LinearDimension(new Line(p3_1, p3_2), fun.CalDistance(v4, v5), 90, dimensionStyle);
                dim23.UserText = "φd1=" + Math.Round(d1 * scale, 1);
                dxf.AddEntity(dim23);

                fun.jt(dxf, new Vector2(v17.X, v17.Y - 2), 45, 20, 2, "R1");

                //1_2
                LinearDimension dim13 = new LinearDimension(new Line(v105, v102), b * 3, 0, dimensionStyle);
                dim13.UserText = "l5=" + Math.Round(l5 * scale, 1);
                dxf.AddEntity(dim13);

                LinearDimension dim14 = new LinearDimension(new Line(v102, v115), b * 3, 0, dimensionStyle);
                dim14.UserText = "l6=" + Math.Round(l6 * scale, 1);
                dxf.AddEntity(dim14);

                LinearDimension dim15 = new LinearDimension(new Line(v118, v111), b * 2, -90, dimensionStyle);
                dim15.UserText = "2×b=" + Math.Round(b * scale, 1);
                dxf.AddEntity(dim15);


                fun.dimrot1(dxf, v118, v115, -90, b, 0, 3, 1, 1, "4*l", "b", "7");
                LinearDimension dim16 = new LinearDimension(new Line(v118, v115), b, -90, dimensionStyle);
                dim16.UserText = "4×l7b=" + Math.Round(l7 * scale, 1);
                //dxf.AddEntity(dim16);

                LinearDimension dim17 = new LinearDimension(new Line(v101, v113_2), b * 2, 180, dimensionStyle);
                dim17.UserText = "j=" + Math.Round(j * scale, 1);
                dxf.AddEntity(dim17);

                //1_3
                fun.jdbz1(dxf, new Line(v13_1, v11_1), new Line(v14_1, v16_1), d6, "60°±15'", 5);

                LinearDimension dim18 = new LinearDimension(new Line(v122, v119), b, 180, dimensionStyle);
                dim18.UserText = "v=" + Math.Round(v * scale, 1);
                dxf.AddEntity(dim18);

                LinearDimension dim19 = new LinearDimension(new Line(v126, v119), b * 2, 180, dimensionStyle);
                dim19.UserText = "x=" + Math.Round(x * scale, 1);
                dxf.AddEntity(dim19);

                fun.jt1(dxf, v13_1, -135, 30, 1, "R1", 2);
                fun.jt1(dxf, v14_1, -45, 30, 1, "R1", 2);

                //1_4
                LinearDimension dim20 = new LinearDimension(new Line(v136, v141), b * 2, 90, dimensionStyle);
                dim20.UserText = "d11=" + Math.Round(d11 * scale, 1);
                dxf.AddEntity(dim20);

                LinearDimension dim21 = new LinearDimension(new Line(v137, v142), b * 1.5, 90, dimensionStyle);
                dim21.UserText = "d2=" + Math.Round(d2 * scale, 1);
                dxf.AddEntity(dim21);

                LinearDimension dim22 = new LinearDimension(new Line(fun.Polar(v138, -45 * pi / 180, fun.CalDistance(v138, v139) / 2), fun.Polar(v143, 45 * pi / 180, fun.CalDistance(v138, v139) / 2)), b * 1.5, 90, dimensionStyle);
                dim22.UserText = "d7=" + Math.Round(d7 * scale, 1);
                dxf.AddEntity(dim22);

                fun.jt1(dxf, v133, 135, 10, 1, "r1", 2);
                fun.jt1(dxf, fun.Polar(v133, -45 * pi / 180, fun.CalDistance(v136, v137) / 2), -135, 10, 2, "r2b", 2);

                //公差
                fun.gcbz(dxf, new Vector2(v1.X, v1.Y + d6), 10, 180, 0.1, 180, 5, 1, 1, "A", "0.02", 2, "ytd", 1);
                fun.gcbz(dxf, new Vector2(v23.X + l1 * 1.3 - (v17.X - v10.X) - 2, v23.Y), 10, -90, 5, 180, 5, 1, 1, "A", "0.05", 2, "ytd", 1);
                fun.gcbz(dxf, new Vector2(fun.mirrorpoint(bz1, v94, v95).X + l1 * 1.4 - 2, fun.mirrorpoint(bz1, v94, v95).Y), 15, -90, 10, 180, 5, 1, 1, "A", "0.05", 2, "ytd", 1);
                fun.gcbz(dxf, new Vector2(v111.X + b * 2 - 2, v111.Y), 20, -90, 5, 180, 5, 1, 1, "A", "t3", 2, "dcd", 0.5);
                fun.gcbz(dxf, fun.Polar(v11_1, 120 * pi / 180, d6 - 25), 10, -150, 5, 180, 5, 1, 1, "A", "0.1", 2, "ytd", 1);
                fun.gcbz(dxf, fun.Polar(v16_1, 60 * pi / 180, d6 - 25), 10, -30, 5, 0, 5, 1, 1, "A", "0.1", 2, "ytd", 1);
                fun.gcbz(dxf, fun.Polar(v142, pi, b * 1.5 - 5), 10, -90, 5, 180, 5, 1, 1, "A", "0.02", 2, "ytd", 1);
                fun.gcbz(dxf, fun.Polar(fun.Polar(v143, 45 * pi / 180, fun.CalDistance(v138, v139) / 2), pi, b * 1.5 - 5), 20, -90, 10, 180, 5, 1, 1, "A", "φ0.1", 2, "tzd", 1);

                //字符
                fun.text(dxf, new Vector2(v119.X, v119.Y - l1), 10, "A");
                fun.text(dxf, new Vector2(v131.X + fun.CalDistance(v131, v132) / 2, v119.Y - l1), 10, "B");

            }

            //AD型和UD型
            if (ctrap == 2)
            {
                Vector2 v6 = new Vector2(v5.X, v5.Y - 1 * scale);
                Vector2 v7 = new Vector2(v6.X + y / 3, v6.Y);
                Vector2 v8 = new Vector2(v7.X, v7.Y + 1 * scale);
                Vector2 v9 = new Vector2(v8.X + y / 3, v8.Y);
                Vector2 v10 = new Vector2(v9.X, d5 / 2);
                Vector2 v11 = new Vector2(v10.X + (u - y) * 1 / 4, v10.Y);
                Vector2 v12 = new Vector2(v11.X + (d5 - d4) * Math.Tan(30 * pi / 180), v11.Y - (d5 - d4));
                Vector2 v13 = new Vector2(v12.X, v12.Y);
                Vector2 v14 = new Vector2(v13.X + (u - y) * 1 / 4, v13.Y);
                Vector2 v15 = new Vector2(v14.X + (d5 - d4) / 2 * Math.Tan(30 * pi / 180), v14.Y + (d5 - d4) / 2);
                Vector2 v16 = new Vector2(v14.X + (d5 - d4) * Math.Tan(30 * pi / 180), v14.Y + (d5 - d4));
                Vector2 v17 = new Vector2(v16.X + (u - y) * 1 / 4, v16.Y);
                Vector2 v18 = new Vector2(v17.X, v17.Y - (v17.Y - v14.Y) * 2);
                Vector2 v19 = new Vector2(v18.X, -v18.Y);
                Vector2 v21 = new Vector2(v18.X, -v18.Y);
                Vector2 v23 = new Vector2(v17.X, -v17.Y);
                Vector2 v22 = new Vector2(v21.X, v21.Y - fun.CalDistance(v21, v23) / 3);
                Vector2 v24 = new Vector2(v16.X, -v16.Y);
                Vector2 v25 = new Vector2(v14.X, -v14.Y);
                Vector2 v26 = new Vector2(v13.X, -v13.Y);
                Vector2 v27 = new Vector2(v11.X, -v11.Y);
                Vector2 v28 = new Vector2(v10.X, -v10.Y);
                Vector2 v29 = new Vector2(v9.X, -v9.Y);
                Vector2 v30 = new Vector2(v8.X, -v8.Y);
                Vector2 v31 = new Vector2(v7.X, -v7.Y);
                Vector2 v32 = new Vector2(v6.X, -v6.Y);
                Vector2 v33 = new Vector2(v5.X, -v5.Y);
                Vector2 v34 = new Vector2(v4.X, -v4.Y);
                Vector2 v35 = new Vector2(v3.X, -v3.Y);
                Vector2 v37 = new Vector2(v2.X, -v2.Y);
                Vector2 v38 = new Vector2(v1.X, -v1.Y);
                Vector2 v49 = new Vector2(v1.X, d11 / 2);
                Vector2 v39 = new Vector2(v49.X, -v49.Y);
                Vector2 v40 = new Vector2(v49.X + Math.Cos(45 * pi / 180) * r2, d2 / 2);
                Vector2 v41 = new Vector2(v40.X + (l4 - Math.Cos(45 * pi / 180) * r2), v40.Y);
                Vector2 v42 = fun.Polar(v41, -45 * pi / 180, r2);
                Vector2 v98 = new Vector2(v41.X + (l2 - l4), v42.Y);
                Vector2 v46 = new Vector2(v42.X, -v42.Y);
                Vector2 v47 = new Vector2(v41.X, -v41.Y);
                Vector2 v48 = new Vector2(v40.X, -v40.Y);
                Vector2 v36 = fun.Polar(v35, ((180 - Math.Atan((v3.Y - v2.Y) / (v3.X - v2.X)) * 180 / pi)) * pi / 180, l1 * 1 / 4 / Math.Cos(α));
                Vector2 v50 = new Vector2(v36.X, -v36.Y);
                Vector2 v51 = new Vector2(v18.X + e / 3, v18.Y);
                Vector2 v52 = new Vector2(v51.X, -v51.Y);
                Vector2 v55 = new Vector2(v52.X, -v52.Y);
                Vector2 v56 = new Vector2(v51.X, -v51.Y);
                Vector2 v96 = new Vector2(v13.X + fun.CalDistance(v13, v14) / 2, v13.Y + (d5 / 2 - d4 / 2) * 4);
                Vector2 v97 = new Vector2(v96.X, v27.Y - (d5 / 2 - d4 / 2) * 4);
                Vector2 v57_1 = new Vector2(v13.X - Math.Sin(30 * pi / 180) * fun.CalDistance(v11, v13) / 2, v13.Y + fun.CalDistance(v13, v14) / 2 / Math.Tan(30 * pi / 180));
                Vector2 v57_2 = new Vector2(v14.X + Math.Sin(30 * pi / 180) * fun.CalDistance(v11, v13) / 2, v14.Y + fun.CalDistance(v13, v14) / 2 / Math.Tan(30 * pi / 180));//切点
                Vector2 v57 = new Vector2(v96.X, v57_1.Y + fun.CalDistance(v57_1, v57_2) / 2 / Math.Tan(60 * pi / 180));
                Vector2 v58 = new Vector2(v57.X, v94.Y);
                Vector2 v59 = new Vector2(v57.X, -v57.Y);
                Vector2 v43 = fun.Inters(v42, new Vector2(v42.X + l1 + e, v42.Y), v51, v52);
                Vector2 v45 = new Vector2(v43.X, -v43.Y);
                Vector2 v53 = new Vector2(v43.X, v43.Y + fun.CalDistance(v43, v45) / 3);
                Vector2 v54 = new Vector2(v53.X, -v53.Y);

                //作图
                LwPolyline polyline1 = new LwPolyline();
                polyline1.Vertexes.Add(new LwPolylineVertex(v1));
                polyline1.Vertexes.Add(new LwPolylineVertex(v2));//0
                polyline1.Vertexes.Add(new LwPolylineVertex(v3));//1
                polyline1.Vertexes.Add(new LwPolylineVertex(v4));//2
                polyline1.Vertexes.Add(new LwPolylineVertex(v5));//3
                polyline1.Vertexes.Add(new LwPolylineVertex(v6));//4
                polyline1.Vertexes.Add(new LwPolylineVertex(v7));//5
                polyline1.Vertexes.Add(new LwPolylineVertex(v8));//6
                polyline1.Vertexes.Add(new LwPolylineVertex(v9));//7
                polyline1.Vertexes.Add(new LwPolylineVertex(v10));//8
                polyline1.Vertexes.Add(new LwPolylineVertex(v11));//9
                polyline1.Vertexes.Add(new LwPolylineVertex(v13));//10
                polyline1.Vertexes.Add(new LwPolylineVertex(v14));//11
                polyline1.Vertexes.Add(new LwPolylineVertex(v16));//12
                polyline1.Vertexes.Add(new LwPolylineVertex(v17));//13
                polyline1.Vertexes.Add(new LwPolylineVertex(v18));//14
                polyline1.Vertexes.Add(new LwPolylineVertex(v51));//15
                polyline1.Vertexes.Add(new LwPolylineVertex(v52));//16
                polyline1.Vertexes[0].Bulge = -Math.Tan((90 - (Math.Atan(7 / 24) * 180 / pi)) * pi / 180 / 4);
                fun.PolyFill(dxf, polyline1, 0.3, contour);

                LwPolyline polyline2 = new LwPolyline();
                polyline2.Vertexes.Add(new LwPolylineVertex(v52));
                polyline2.Vertexes.Add(new LwPolylineVertex(v19));//0
                polyline2.Vertexes.Add(new LwPolylineVertex(v23));
                polyline2.Vertexes.Add(new LwPolylineVertex(v24));
                polyline2.Vertexes.Add(new LwPolylineVertex(v25));
                polyline2.Vertexes.Add(new LwPolylineVertex(v26));
                polyline2.Vertexes.Add(new LwPolylineVertex(v27));
                polyline2.Vertexes.Add(new LwPolylineVertex(v28));
                polyline2.Vertexes.Add(new LwPolylineVertex(v29));
                polyline2.Vertexes.Add(new LwPolylineVertex(v30));
                polyline2.Vertexes.Add(new LwPolylineVertex(v31));
                polyline2.Vertexes.Add(new LwPolylineVertex(v32));
                polyline2.Vertexes.Add(new LwPolylineVertex(v33));
                polyline2.Vertexes.Add(new LwPolylineVertex(v34));
                polyline2.Vertexes.Add(new LwPolylineVertex(v35));
                polyline2.Vertexes.Add(new LwPolylineVertex(v37));
                polyline2.Vertexes.Add(new LwPolylineVertex(v38));//15
                polyline2.Vertexes.Add(new LwPolylineVertex(v1));
                polyline2.Vertexes[15].Bulge = -Math.Tan((90 - (Math.Atan(7 / 24) * 180 / pi)) * pi / 180 / 4);
                fun.PolyFill(dxf, polyline2, 0.3, contour);

                LwPolyline polyline3 = new LwPolyline();
                polyline3.Vertexes.Add(new LwPolylineVertex(v49));
                polyline3.Vertexes.Add(new LwPolylineVertex(v40));
                polyline3.Vertexes.Add(new LwPolylineVertex(v41));
                polyline3.Vertexes.Add(new LwPolylineVertex(v42));
                polyline3.Vertexes.Add(new LwPolylineVertex(v43));
                fun.PolyFill(dxf, polyline3, 0.3, contour);

                LwPolyline polyline4 = new LwPolyline();
                polyline4.Vertexes.Add(new LwPolylineVertex(v39));
                polyline4.Vertexes.Add(new LwPolylineVertex(v48));
                polyline4.Vertexes.Add(new LwPolylineVertex(v47));
                polyline4.Vertexes.Add(new LwPolylineVertex(v46));
                polyline4.Vertexes.Add(new LwPolylineVertex(v45));
                fun.PolyFill(dxf, polyline4, 0.3, contour);

                Vector2[] Line1 = { v40, v48 };
                fun.drawBLine(dxf, Line1, 0.3, contour);

                Vector2[] Line2 = { v41, v47 };
                fun.drawBLine(dxf, Line2, 0.3, contour);

                Vector2[] Line3 = { v42, v46 };
                fun.drawBLine(dxf, Line3, 0.3, contour);

                LwPolyline Arc1 = new LwPolyline();
                Arc1.Vertexes.Add(new LwPolylineVertex(v50));
                Arc1.Vertexes.Add(new LwPolylineVertex(v53));//0
                Arc1.Vertexes[0].Bulge = Math.Tan(40 * pi / 180 / 4);
                fun.PolyFill(dxf, Arc1, 0.3, contour);

                LwPolyline Arc2 = new LwPolyline();
                Arc2.Vertexes.Add(new LwPolylineVertex(v54));
                Arc2.Vertexes.Add(new LwPolylineVertex(v36));//0
                Arc2.Vertexes[0].Bulge = Math.Tan(40 * pi / 180 / 4);
                fun.PolyFill(dxf, Arc2, 0.3, contour);

                LwPolyline hatchpoly1 = new LwPolyline();
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v1));
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v2));//0
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v50));//1
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v53));//2
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v43));//3
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v42));//4
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v41));//5
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v40));//6
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v49));//7
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v1));//8
                hatchpoly1.Vertexes[0].Bulge = -Math.Tan((90 - (Math.Atan(7 / 24) * 180 / pi)) * pi / 180 / 4);
                hatchpoly1.Vertexes[2].Bulge = Math.Tan(40 * pi / 180 / 4);
                hatchpoly1.IsClosed = true;
                String[] htype1 = new String[100];
                Line[] hline1 = new Line[100];
                Arc[] harc1 = new Arc[100];
                int hnumst1 = hatchpoly1.Explode().Count;  //记录爆炸后，线段有多少
                for (int i = 0; i < hnumst1; i++)
                {
                    htype1[i] = hatchpoly1.Explode()[i].Type.ToString();    //将所有的元素记录成一个数组
                    if (htype1[i] == "Line")
                    {
                        hline1[i] = (Line)hatchpoly1.Explode()[i];
                    }
                    if (htype1[i] == "Arc")
                    {
                        harc1[i] = (Arc)hatchpoly1.Explode()[i];
                    }
                }
                fun.hatchsub1(dxf, htype1, hnumst1, 45, 10, hline1, harc1, hatching);

                LwPolyline hatchpoly2 = new LwPolyline();
                hatchpoly2.Vertexes.Add(new LwPolylineVertex(v38));
                hatchpoly2.Vertexes.Add(new LwPolylineVertex(v37));//0
                hatchpoly2.Vertexes.Add(new LwPolylineVertex(v36));//1
                hatchpoly2.Vertexes.Add(new LwPolylineVertex(v54));//2
                hatchpoly2.Vertexes.Add(new LwPolylineVertex(v45));//3
                hatchpoly2.Vertexes.Add(new LwPolylineVertex(v46));//4
                hatchpoly2.Vertexes.Add(new LwPolylineVertex(v47));//5
                hatchpoly2.Vertexes.Add(new LwPolylineVertex(v48));//6
                hatchpoly2.Vertexes.Add(new LwPolylineVertex(v39));//7
                hatchpoly2.Vertexes.Add(new LwPolylineVertex(v38));//8
                hatchpoly2.Vertexes[0].Bulge = Math.Tan((90 - (Math.Atan(7 / 24) * 180 / pi)) * pi / 180 / 4);
                hatchpoly2.Vertexes[2].Bulge = -Math.Tan(40 * pi / 180 / 4);
                hatchpoly2.IsClosed = true;
                String[] htype2 = new String[100];
                Line[] hline2 = new Line[100];
                Arc[] harc2 = new Arc[100];
                int hnumst2 = hatchpoly2.Explode().Count;  //记录爆炸后，线段有多少
                for (int i = 0; i < hnumst1; i++)
                {
                    htype2[i] = hatchpoly2.Explode()[i].Type.ToString();    //将所有的元素记录成一个数组
                    if (htype2[i] == "Line")
                    {
                        hline2[i] = (Line)hatchpoly2.Explode()[i];
                    }
                    if (htype2[i] == "Arc")
                    {
                        harc2[i] = (Arc)hatchpoly2.Explode()[i];
                    }
                }
                fun.hatchsub1(dxf, htype2, hnumst2, 45, 10, hline2, harc2, hatching);

                Line centreline = new Line(v94, v95);
                centreline.Layer = centre;
                centreline.LinetypeScale = 5;
                centreline.Lineweight = Lineweight.W25;
                centreline.Linetype = Linetype.Dashed;
                dxf.AddEntity(centreline);

                //1_2
                //点
                Vector2 v98_1 = new Vector2(v95.X + l1, v95.Y);
                Vector2 v99 = new Vector2(v98_1.X + l5 * 4, v98_1.Y);
                Vector2 v102 = new Vector2(v98_1.X + fun.CalDistance(v98_1, v99) / 2, v98_1.Y);
                Vector2 v100 = new Vector2(v102.X, v102.Y + fun.CalDistance(v98_1, v99) / 2);
                Vector2 v101 = new Vector2(v102.X, v102.Y - fun.CalDistance(v98_1, v99) / 2);
                Vector2 v103 = new Vector2(v102.X - Math.Tan(Math.Acos(b / 2 / (d5 / 2))) * b / 2, v102.Y + b / 2);
                Vector2 v105 = new Vector2(v102.X - l5, v103.Y - l7);
                Vector2 v104 = new Vector2(v105.X - l7, v103.Y);
                Vector2 v110 = new Vector2(v103.X, -v103.Y);
                Vector2 v106 = new Vector2(v105.X, -v105.Y);
                Vector2 v107 = new Vector2(v104.X, -v104.Y);
                Vector2 v118 = new Vector2(v102.X + Math.Tan(Math.Acos(b / 2 / (d5 / 2))) * b / 2, v102.Y + b / 2);
                Vector2 v115 = new Vector2(v102.X + l6, v118.Y - l7);
                Vector2 v116 = new Vector2(v115.X + l7, v115.Y + l7);
                Vector2 v111 = new Vector2(v118.X, -v118.Y);
                Vector2 v113 = new Vector2(v116.X, -v116.Y);
                Vector2 v114 = new Vector2(v115.X, -v115.Y);

                Arc arc1_2_1 = new Arc(v102, fun.CalDistance(v102, v103), 0, -90);
                Vector2 v113_1 = fun.getPointForArcandLine(v113, new Vector2(v113.X, v113.Y - l1), v102, arc1_2_1);
                Vector2 v113_3 = fun.mirrorpoint(v113_1, v102, fun.Polar(v102, -45 * pi / 180, 10));
                Vector2 v113_2 = new Vector2(v102.X + j, v113_1.Y);

                //作图
                fun.drawcircle(dxf, v102, fun.CalDistance(v42, v46) / 2, 0.3, contour);
                fun.drawcircle(dxf, v102, fun.CalDistance(v41, v47) / 2, 0.01, contour);
                fun.drawcircle(dxf, v102, fun.CalDistance(v49, v39) / 2, 0.01, contour);
                fun.drawcircle(dxf, v102, l5, 0.3, contour);
                fun.drawcircle(dxf, v102, fun.CalDistance(v2, v37) / 2, 0.3, contour);

                LwPolyline ddx1 = new LwPolyline();
                ddx1.Vertexes.Add(new LwPolylineVertex(v103));
                ddx1.Vertexes.Add(new LwPolylineVertex(v104));//0
                ddx1.Vertexes.Add(new LwPolylineVertex(v105));//1
                ddx1.Vertexes.Add(new LwPolylineVertex(v106));//2
                ddx1.Vertexes.Add(new LwPolylineVertex(v107));//3
                ddx1.Vertexes.Add(new LwPolylineVertex(v110));//4
                ddx1.Vertexes.Add(new LwPolylineVertex(v111));//5
                ddx1.Vertexes.Add(new LwPolylineVertex(v113));//6
                ddx1.Vertexes.Add(new LwPolylineVertex(v114));//7
                ddx1.Vertexes.Add(new LwPolylineVertex(v115));//8
                ddx1.Vertexes.Add(new LwPolylineVertex(v116));//9
                ddx1.Vertexes.Add(new LwPolylineVertex(v118));//10
                ddx1.Vertexes.Add(new LwPolylineVertex(v103));//11
                ddx1.Vertexes[1].Bulge = -Math.Tan(90 * pi / 180 / 4);
                ddx1.Vertexes[3].Bulge = -Math.Tan(90 * pi / 180 / 4);
                ddx1.Vertexes[5].Bulge = Math.Tan(Math.Acos(b / 2 / (d5 / 2)) * 2 / 4);
                ddx1.Vertexes[7].Bulge = -Math.Tan(90 * pi / 180 / 4);
                ddx1.Vertexes[9].Bulge = -Math.Tan(90 * pi / 180 / 4);
                ddx1.Vertexes[11].Bulge = Math.Tan(Math.Acos(b / 2 / (d5 / 2)) * 2 / 4);
                fun.PolyFill(dxf, ddx1, 0.3, contour);

                Line centreline1_2_1 = new Line(v98_1, v99);
                centreline1_2_1.Linetype = Linetype.Center;
                centreline1_2_1.Lineweight = Lineweight.W25;
                centreline1_2_1.Layer = centre;
                dxf.AddEntity(centreline1_2_1);

                Line centreline1_2_2 = new Line(v100, v101);
                centreline1_2_2.Linetype = Linetype.Center;
                centreline1_2_2.Lineweight = Lineweight.W25;
                centreline1_2_2.Layer = centre;
                dxf.AddEntity(centreline1_2_2);

                LwPolyline ddx3 = new LwPolyline();
                ddx3.Vertexes.Add(new LwPolylineVertex(v113_1));
                ddx3.Vertexes.Add(new LwPolylineVertex(v113_2));//0
                ddx3.Vertexes.Add(new LwPolylineVertex(v113_3));//1
                fun.PolyFill(dxf, ddx3, 0.3, contour);

                //标注样式
                //箭头样式
                DimensionStyle dimensionStyle = fun.CreateDimStyle();
                dimensionStyle.ArrowSize = 1;
                dimensionStyle.ExtLineExtend = 0.6;//标注延长线长度/2
                dimensionStyle.DimArrow1 = DimensionArrowhead.Closedfilled;
                dimensionStyle.DimArrow2 = DimensionArrowhead.Closedfilled;

                //文本样式
                dimensionStyle.TextHeight = 1;

                //标注
                //线段尺寸标注
                //1_1
                LinearDimension dim1 = new LinearDimension(new Line(v1, p3_1), d6 / 2, 0, dimensionStyle);
                dim1.UserText = "l1=" + Math.Round(l1 * scale, 1);
                dxf.AddEntity(dim1);

                LinearDimension dim4 = new LinearDimension(new Line(v1, v41), d6 - d6 / 6 * 4, 0, dimensionStyle);
                dim4.UserText = "l4=" + Math.Round(l4 * scale, 1);
                dxf.AddEntity(dim4);

                double f = fun.CalDistance(v11, v17);
                LinearDimension dim7 = new LinearDimension(new Line(v10, v17), d6 - d6 / 6 * 3 - (v10.Y - v1.Y), 0, dimensionStyle);
                dim7.UserText = "(f)=" + Math.Round(f * scale, 1);
                dxf.AddEntity(dim7);

                LinearDimension dim8 = new LinearDimension(new Line(p3_1, v10), d6 - d6 / 6 * 4 - (v10.Y - v3.Y), 0, dimensionStyle);
                dim8.UserText = "y=" + Math.Round(y * scale, 1);
                dxf.AddEntity(dim8);

                LinearDimension dim10 = new LinearDimension(new Line(v17, v23), l1 * 1.3 - (v17.X - v10.X), -90, dimensionStyle);
                dim10.UserText = "φd5=" + Math.Round(d5 * scale, 1);
                dxf.AddEntity(dim10);

                LinearDimension dim23 = new LinearDimension(new Line(p3_1, p3_2), 0, 90, dimensionStyle);
                dim23.UserText = "φd1=" + Math.Round(d1 * scale, 1);
                dxf.AddEntity(dim23);

                //1_2
                LinearDimension dim13 = new LinearDimension(new Line(v105, v102), b * 3, 0, dimensionStyle);
                dim13.UserText = "l5=" + Math.Round(l5 * scale, 1);
                dxf.AddEntity(dim13);

                LinearDimension dim14 = new LinearDimension(new Line(v102, v115), b * 3, 0, dimensionStyle);
                dim14.UserText = "l6=" + Math.Round(l6 * scale, 1);
                dxf.AddEntity(dim14);

                LinearDimension dim15 = new LinearDimension(new Line(v118, v111), b * 2, -90, dimensionStyle);
                dim15.UserText = "2×b=" + Math.Round(b * scale, 1);
                dxf.AddEntity(dim15);

                LinearDimension dim16 = new LinearDimension(new Line(v118, v115), b, -90, dimensionStyle);
                dim16.UserText = "4×l7b=" + Math.Round(l7 * scale, 1);
                dxf.AddEntity(dim16);

                LinearDimension dim17 = new LinearDimension(new Line(v101, v113_2), b * 2, 180, dimensionStyle);
                dim17.UserText = "j=" + Math.Round(j * scale, 1);
                dxf.AddEntity(dim17);

                double d10 = fun.CalDistance(v43, v45);
                LinearDimension dim18 = new LinearDimension(new Line(v43, v45), b, -90, dimensionStyle);
                dim18.UserText = "φd10=" + Math.Round(d10 * scale, 1);
                dxf.AddEntity(dim18);

                //公差
                fun.gcbz(dxf, new Vector2(v1.X, v1.Y + d6 / 2), 10, 180, 0.1, 180, 5, 1, 1, "A", "0.02", 2, "ytd", 1);
                fun.gcbz(dxf, new Vector2(v23.X + l1 * 1.3 - (v17.X - v10.X) - 2, v23.Y), 10, -90, 5, 180, 5, 1, 1, "A", "0.05", 2, "ytd", 1);
                fun.gcbz(dxf, new Vector2(v111.X + b * 2 - 2, v111.Y), 20, -90, 5, 180, 5, 1, 1, "A", "t3", 2, "dcd", 0.5);
            }

            if (ctrap == 3)
            {
                //A型和U型
                //坐标
                Vector2 v6 = new Vector2(v5.X, v5.Y - 1 * scale);
                Vector2 v7 = new Vector2(v6.X + y / 3, v6.Y);
                Vector2 v8 = new Vector2(v7.X, v7.Y + 1 * scale);
                Vector2 v9 = new Vector2(v3.X + fun.CalDistance(v4, v5) * 2, v3.Y);
                Vector2 v10 = new Vector2(v9.X, d5 / 2);
                Vector2 v11 = new Vector2(v10.X + (u - y) * 1 / 4, v10.Y);
                Vector2 v12 = new Vector2(v11.X + (d5 - d4) * Math.Tan(30 * pi / 180), v11.Y - (d5 - d4));
                Vector2 v13 = new Vector2(v12.X, v12.Y);
                Vector2 v14 = new Vector2(v13.X + (u - y) * 1 / 4, v13.Y);
                Vector2 v15 = new Vector2(v14.X + (d5 - d4) / 2 * Math.Tan(30 * pi / 180), v14.Y + (d5 - d4) / 2);
                Vector2 v16 = new Vector2(v14.X + (d5 - d4) * Math.Tan(30 * pi / 180), v14.Y + (d5 - d4));
                Vector2 v17 = new Vector2(v16.X + (u - y) * 1 / 4, v16.Y);
                Vector2 v18 = new Vector2(v17.X, v17.Y - (d5 / 2 - (d5 - d3)));
                Vector2 v21 = new Vector2(v18.X, -v18.Y);
                Vector2 v23 = new Vector2(v17.X, -v17.Y);
                Vector2 v22 = new Vector2(v21.X, v21.Y - fun.CalDistance(v21, v23) / 3);
                Vector2 v24 = new Vector2(v16.X, -v16.Y);
                Vector2 v25 = new Vector2(v14.X, -v14.Y);
                Vector2 v26 = new Vector2(v13.X, -v13.Y);
                Vector2 v27 = new Vector2(v11.X, -v11.Y);
                Vector2 v28 = new Vector2(v10.X, -v10.Y);
                Vector2 v29 = new Vector2(v9.X, -v9.Y);
                Vector2 v30 = new Vector2(v8.X, -v8.Y);
                Vector2 v31 = new Vector2(v7.X, -v7.Y);
                Vector2 v32 = new Vector2(v6.X, -v6.Y);
                Vector2 v33 = new Vector2(v5.X, -v5.Y);
                Vector2 v34 = new Vector2(v4.X, -v4.Y);
                Vector2 v35 = new Vector2(v3.X, -v3.Y);
                Vector2 v37 = new Vector2(v2.X, -v2.Y);
                Vector2 v38 = new Vector2(v1.X, -v1.Y);
                Vector2 v49 = new Vector2(v1.X, d11 / 2);
                Vector2 v39 = new Vector2(v49.X, -v49.Y);
                Vector2 v40 = new Vector2(v49.X + Math.Cos(45 * pi / 180) * r2, d2 / 2);
                Vector2 v41 = new Vector2(v40.X + (l4 - Math.Cos(45 * pi / 180) * r2), v40.Y);
                Vector2 v42 = fun.Polar(v41, -45 * pi / 180, r2);
                Vector2 v98 = new Vector2(v41.X + (l2 - l4), v42.Y);
                Vector2 v43 = new Vector2(v1.X + l3, v42.Y);
                Vector2 v44 = new Vector2(v43.X + v43.Y / 2, v94.Y);
                Vector2 v45 = new Vector2(v43.X, -v43.Y);
                Vector2 v46 = new Vector2(v42.X, -v42.Y);
                Vector2 v47 = new Vector2(v41.X, -v41.Y);
                Vector2 v48 = new Vector2(v40.X, -v40.Y);
                Vector2 v36 = fun.Polar(v35, ((180 - Math.Atan((v3.Y - v2.Y) / (v3.X - v2.X)) * 180 / pi)) * pi / 180, l1 * 1 / 4 / Math.Cos(α));
                Vector2 v50 = new Vector2(v36.X, -v36.Y);
                Vector2 v51 = new Vector2(v50.X, v50.Y - d1 * 1 / 8);
                Vector2 v52 = fun.Polar(v51, -70 * pi / 180, fun.CalDistance(v43, v44) * 2 / 3);
                Vector2 v53 = fun.Polar(v52, -60 * pi / 180, fun.CalDistance(v43, v44) * 1 / 3);
                Vector2 v54 = new Vector2(v53.X, -v53.Y);
                Vector2 v55 = new Vector2(v52.X, -v52.Y);
                Vector2 v56 = new Vector2(v51.X, -v51.Y);
                Vector2 v96 = new Vector2(v13.X + fun.CalDistance(v13, v14) / 2, v13.Y + (d5 / 2 - d4 / 2) * 4);
                Vector2 v97 = new Vector2(v96.X, v27.Y - (d5 / 2 - d4 / 2) * 4);
                Vector2 v57_1 = new Vector2(v13.X - Math.Sin(30 * pi / 180) * fun.CalDistance(v11, v13) / 2, v13.Y + fun.CalDistance(v13, v14) / 2 / Math.Tan(30 * pi / 180));
                Vector2 v57_2 = new Vector2(v14.X + Math.Sin(30 * pi / 180) * fun.CalDistance(v11, v13) / 2, v14.Y + fun.CalDistance(v13, v14) / 2 / Math.Tan(30 * pi / 180));//切点
                Vector2 v57 = new Vector2(v96.X, v57_1.Y + fun.CalDistance(v57_1, v57_2) / 2 / Math.Tan(60 * pi / 180));
                Vector2 v58 = new Vector2(v57.X, v94.Y);
                Vector2 v59 = new Vector2(v57.X, -v57.Y);

                Vector2 v51_1 = new Vector2(v9.X, v9.Y + fun.CalDistance(v3, v4));
                Vector2 v52_1 = new Vector2(v51_1.X, v51_1.Y + fun.CalDistance(v3, v9));
                Vector2 v53_1 = fun.Polar(v52_1, -45 * pi / 180, fun.CalDistance(v9, v10) * 1.5);
                Vector2 v55_1 = fun.Polar(v53_1, -135 * pi / 180, fun.CalDistance(fun.Inters(v51_1, fun.Polar(v51_1, 45 * pi / 180, l1), v52_1, v53_1), v51_1));
                Vector2 v54_1 = fun.Polar(new Vector2(v51_1.X, v51_1.Y + fun.CalDistance(v51_1, v52_1) / 2), -45 * pi / 180, fun.CalDistance(v52_1, v53_1));
                Vector2 v51_2 = new Vector2(v51_1.X, -v51_1.Y);
                Vector2 v52_2 = new Vector2(v52_1.X, -v52_1.Y);
                Vector2 v53_2 = new Vector2(v53_1.X, -v53_1.Y);
                Vector2 v54_2 = new Vector2(v54_1.X, -v54_1.Y);
                Vector2 v55_2 = new Vector2(v55_1.X, -v55_1.Y);

                Vector2 bu1 = new Vector2(v18.X, v9.Y);
                Vector2 bu1_1 = new Vector2(bu1.X + e / 3, bu1.Y);
                Vector2 bu2 = new Vector2(bu1.X, -bu1.Y);
                Vector2 bu2_1 = new Vector2(bu1_1.X, -bu1_1.Y);
                Vector2 bu3 = new Vector2(bu1_1.X, bu1_1.Y - fun.CalAngle(bu1_1, bu2_1) / 3);
                Vector2 bu4 = fun.Polar(bu3, -105 * pi / 180, fun.CalAngle(bu1_1, bu2_1) / 5);
                Vector2 bu5 = new Vector2(bu4.X - fun.CalAngle(bu1_1, bu2_1) / 8, v94.Y);
                Vector2 bu6 = new Vector2(bu3.X, -bu3.Y);
                Vector2 bu7 = new Vector2(bu4.X, -bu4.Y);

                //样条线点
                Vector2 p1 = new Vector2(bu1_1.X, bu1.Y - d3 / 6);
                Vector2 p2 = fun.Polar(p1, -100 * pi / 180, d3 / 6);
                Vector2 p3 = fun.Inters(p2, fun.Polar(p2, -100 * pi / 180, l1), v94, v95);
                Vector2 p4 = new Vector2(p3.X, -p3.Y);
                Vector2 p5 = new Vector2(p2.X, -p2.Y);
                Vector2 p6 = new Vector2(p1.X, -p1.Y);

                Vector2 v66 = new Vector2(bu1_1.X - fun.CalDistance(bu1, bu1_1) / 4 * 3, bu1.Y);
                Vector2 p1_1 = new Vector2(v66.X, v66.Y - d3 / 6);
                Vector2 p2_1 = fun.Polar(p1_1, -100 * pi / 180, d3 / 6);
                Vector2 p3_1_1 = fun.Inters(p2_1, fun.Polar(p2_1, -100 * pi / 180, l1), v94, v95);
                Vector2 p4_1 = new Vector2(p3_1_1.X, -p3_1_1.Y);
                Vector2 p5_1 = new Vector2(p2_1.X, -p2_1.Y);
                Vector2 p6_1 = new Vector2(p1_1.X, -p1_1.Y);
                Vector2 v67 = new Vector2(v66.X, -v66.Y);

                //新增虚线点

                Vector2 v64 = fun.Inters(p2, fun.Polar(p2, pi, l1), v53_1, fun.Polar(v53_1, -45 * pi / 180, l1));
                Vector2 v65 = new Vector2(v64.X, -v64.Y);
                Vector2 v61 = fun.Inters(v55_1, fun.Polar(v55_1, -45 * pi / 180, l1), v94, v95);

                //作图
                LwPolyline polyline1 = new LwPolyline();
                polyline1.Vertexes.Add(new LwPolylineVertex(v1));
                polyline1.Vertexes.Add(new LwPolylineVertex(v2));//0
                polyline1.Vertexes.Add(new LwPolylineVertex(v3));//1
                polyline1.Vertexes.Add(new LwPolylineVertex(v9));//2
                polyline1.Vertexes.Add(new LwPolylineVertex(v10));//3
                polyline1.Vertexes.Add(new LwPolylineVertex(v11));//4
                polyline1.Vertexes.Add(new LwPolylineVertex(v13));//5
                polyline1.Vertexes.Add(new LwPolylineVertex(v14));//6
                polyline1.Vertexes.Add(new LwPolylineVertex(v16));//7
                polyline1.Vertexes.Add(new LwPolylineVertex(v17));//8
                polyline1.Vertexes.Add(new LwPolylineVertex(bu1));//9
                polyline1.Vertexes.Add(new LwPolylineVertex(bu1_1));//10
                polyline1.Vertexes[0].Bulge = -Math.Tan((90 - (Math.Atan(7 / 24) * 180 / pi)) * pi / 180 / 4);
                fun.PolyFill(dxf, polyline1, 0.3, contour);

                LwPolyline polyline2 = new LwPolyline();
                polyline2.Vertexes.Add(new LwPolylineVertex(bu1_1));
                polyline2.Vertexes.Add(new LwPolylineVertex(p1));//0
                polyline2.Vertexes.Add(new LwPolylineVertex(p2));//1
                polyline2.Vertexes.Add(new LwPolylineVertex(p3));//2
                polyline2.Vertexes.Add(new LwPolylineVertex(p4));//3
                polyline2.Vertexes.Add(new LwPolylineVertex(p5));//4
                polyline2.Vertexes.Add(new LwPolylineVertex(p6));//5
                polyline2.Vertexes.Add(new LwPolylineVertex(bu2_1));//6
                polyline2.Vertexes[0].Bulge = -Math.Tan(40 * pi / 180 / 4);
                polyline2.Vertexes[1].Bulge = Math.Tan(20 * pi / 180 / 4);
                polyline2.Vertexes[2].Bulge = Math.Tan(20 * pi / 180 / 4);
                polyline2.Vertexes[3].Bulge = Math.Tan(20 * pi / 180 / 4);
                polyline2.Vertexes[4].Bulge = Math.Tan(20 * pi / 180 / 4);
                polyline2.Vertexes[5].Bulge = Math.Tan(20 * pi / 180 / 4);
                polyline2.Vertexes[6].Bulge = -Math.Tan(40 * pi / 180 / 4);
                fun.PolyFill(dxf, polyline2, 0.1, additionalline);

                LwPolyline polyline3 = new LwPolyline();
                polyline3.Vertexes.Add(new LwPolylineVertex(bu2_1));
                polyline3.Vertexes.Add(new LwPolylineVertex(bu2));
                polyline3.Vertexes.Add(new LwPolylineVertex(v23));
                polyline3.Vertexes.Add(new LwPolylineVertex(v24));
                polyline3.Vertexes.Add(new LwPolylineVertex(v25));
                polyline3.Vertexes.Add(new LwPolylineVertex(v26));
                polyline3.Vertexes.Add(new LwPolylineVertex(v27));
                polyline3.Vertexes.Add(new LwPolylineVertex(v28));
                polyline3.Vertexes.Add(new LwPolylineVertex(v29));
                polyline3.Vertexes.Add(new LwPolylineVertex(v35));
                polyline3.Vertexes.Add(new LwPolylineVertex(v37));
                polyline3.Vertexes.Add(new LwPolylineVertex(v38));//10
                polyline3.Vertexes.Add(new LwPolylineVertex(v1));
                polyline3.Vertexes[10].Bulge = -Math.Tan((90 - (Math.Atan(7 / 24) * 180 / pi)) * pi / 180 / 4);
                fun.PolyFill(dxf, polyline3, 0.3, contour);

                LwPolyline polyline4 = new LwPolyline();
                polyline4.Vertexes.Add(new LwPolylineVertex(v50));
                polyline4.Vertexes.Add(new LwPolylineVertex(v51));//0
                polyline4.Vertexes.Add(new LwPolylineVertex(v52));//1
                polyline4.Vertexes.Add(new LwPolylineVertex(v53));//2
                polyline4.Vertexes.Add(new LwPolylineVertex(v54));//3
                polyline4.Vertexes.Add(new LwPolylineVertex(v55));//4
                polyline4.Vertexes.Add(new LwPolylineVertex(v56));//5
                polyline4.Vertexes.Add(new LwPolylineVertex(v36));//6
                polyline4.Vertexes[1].Bulge = Math.Tan(10 * pi / 180);
                polyline4.Vertexes[2].Bulge = -Math.Tan(10 * pi / 180);
                polyline4.Vertexes[3].Bulge = -Math.Tan(5 * pi / 180);
                polyline4.Vertexes[4].Bulge = -Math.Tan(10 * pi / 180);
                polyline4.Vertexes[5].Bulge = Math.Tan(10 * pi / 180);
                fun.PolyFill(dxf, polyline4, 0.1, additionalline);

                LwPolyline polyline5 = new LwPolyline();
                polyline5.Vertexes.Add(new LwPolylineVertex(v66));
                polyline5.Vertexes.Add(new LwPolylineVertex(p1_1));//0
                polyline5.Vertexes.Add(new LwPolylineVertex(p2_1));//1
                polyline5.Vertexes.Add(new LwPolylineVertex(p3_1_1));//2
                polyline5.Vertexes.Add(new LwPolylineVertex(p4_1));//3
                polyline5.Vertexes.Add(new LwPolylineVertex(p5_1));//4
                polyline5.Vertexes.Add(new LwPolylineVertex(p6_1));//5
                polyline5.Vertexes.Add(new LwPolylineVertex(v67));//6
                polyline5.Vertexes[0].Bulge = -Math.Tan(40 * pi / 180 / 4);
                polyline5.Vertexes[1].Bulge = Math.Tan(20 * pi / 180 / 4);
                polyline5.Vertexes[2].Bulge = Math.Tan(20 * pi / 180 / 4);
                polyline5.Vertexes[3].Bulge = Math.Tan(20 * pi / 180 / 4);
                polyline5.Vertexes[4].Bulge = Math.Tan(20 * pi / 180 / 4);
                polyline5.Vertexes[5].Bulge = Math.Tan(20 * pi / 180 / 4);
                fun.PolyFill(dxf, polyline5, 0.1, additionalline);

                LwPolyline polyline6 = new LwPolyline();
                polyline6.Vertexes.Add(new LwPolylineVertex(v52_1));
                polyline6.Vertexes.Add(new LwPolylineVertex(v53_1));
                polyline6.Vertexes.Add(new LwPolylineVertex(v55_1));
                polyline6.Vertexes.Add(new LwPolylineVertex(v51_1));
                fun.PolyFill(dxf, polyline6, 0.3, contour);

                LwPolyline polyline7 = new LwPolyline();
                polyline7.Vertexes.Add(new LwPolylineVertex(v53_1));
                polyline7.Vertexes.Add(new LwPolylineVertex(v54_1));
                polyline7.Vertexes.Add(new LwPolylineVertex(v55_1));
                fun.PolyFill(dxf, polyline7, 0.3, contour);

                LwPolyline polyline8 = new LwPolyline();
                polyline8.Vertexes.Add(new LwPolylineVertex(v52_2));
                polyline8.Vertexes.Add(new LwPolylineVertex(v53_2));
                polyline8.Vertexes.Add(new LwPolylineVertex(v55_2));
                polyline8.Vertexes.Add(new LwPolylineVertex(v51_2));
                fun.PolyFill(dxf, polyline8, 0.3, contour);

                LwPolyline polyline9 = new LwPolyline();
                polyline9.Vertexes.Add(new LwPolylineVertex(v53_2));
                polyline9.Vertexes.Add(new LwPolylineVertex(v54_2));
                polyline9.Vertexes.Add(new LwPolylineVertex(v55_2));
                fun.PolyFill(dxf, polyline9, 0.3, contour);

                Line line1 = new Line(v49, v40);
                line1.Layer = refin;
                line1.Linetype = Linetype.Dashed;
                line1.Lineweight = Lineweight.W25;
                dxf.AddEntity(line1);

                Line line2 = new Line(v40, v41);
                line2.Layer = refin;
                line2.Linetype = Linetype.Dashed;
                line2.Lineweight = Lineweight.W25;
                dxf.AddEntity(line2);

                Line line3 = new Line(v41, v42);
                line3.Layer = refin;
                line3.Linetype = Linetype.Dashed;
                line3.Lineweight = Lineweight.W25;
                dxf.AddEntity(line3);

                Line line4 = new Line(v42, v43);
                line4.Layer = refin;
                line4.Linetype = Linetype.Dashed;
                line4.Lineweight = Lineweight.W25;
                dxf.AddEntity(line4);

                Line line5 = new Line(v43, v44);
                line5.Layer = refin;
                line5.Linetype = Linetype.Dashed;
                line5.Lineweight = Lineweight.W25;
                dxf.AddEntity(line5);

                Line line7 = new Line(v41, v47);
                line7.Layer = refin;
                line7.Linetype = Linetype.Dashed;
                line7.Lineweight = Lineweight.W25;
                dxf.AddEntity(line7);

                Line line8 = new Line(v42, v46);
                line8.Layer = refin;
                line8.Linetype = Linetype.Dashed;
                line8.Lineweight = Lineweight.W25;
                dxf.AddEntity(line8);

                Line line9 = new Line(v40, v48);
                line9.Layer = refin;
                line9.Linetype = Linetype.Dashed;
                line9.Lineweight = Lineweight.W25;
                dxf.AddEntity(line9);

                Line line10 = new Line(v43, v45);
                line10.Layer = refin;
                line10.Linetype = Linetype.Dashed;
                line10.Lineweight = Lineweight.W25;
                dxf.AddEntity(line10);

                Line line11 = new Line(v53_1, v64);
                line11.Layer = refin;
                line11.Linetype = Linetype.Dashed;
                line11.Lineweight = Lineweight.W25;
                dxf.AddEntity(line11);

                Line line12 = new Line(v64, p2);
                line12.Layer = refin;
                line12.Linetype = Linetype.Dashed;
                line12.Lineweight = Lineweight.W25;
                dxf.AddEntity(line12);

                Line line13 = new Line(v55_1, v61);
                line13.Layer = refin;
                line13.Linetype = Linetype.Dashed;
                line13.Lineweight = Lineweight.W25;
                dxf.AddEntity(line13);

                Line line14 = new Line(v55_2, v61);
                line14.Layer = refin;
                line14.Linetype = Linetype.Dashed;
                line14.Lineweight = Lineweight.W25;
                dxf.AddEntity(line14);

                Line line15 = new Line(v53_2, v65);
                line15.Layer = refin;
                line15.Linetype = Linetype.Dashed;
                line15.Lineweight = Lineweight.W25;
                dxf.AddEntity(line15);

                Line line16 = new Line(v65, p5);
                line16.Layer = refin;
                line16.Linetype = Linetype.Dashed;
                line16.Lineweight = Lineweight.W25;
                dxf.AddEntity(line16);

                Line line17 = new Line(v44, v45);
                line17.Layer = refin;
                line17.Linetype = Linetype.Dashed;
                line17.Lineweight = Lineweight.W25;
                dxf.AddEntity(line17);

                Line line18 = new Line(v45, v46);
                line18.Layer = refin;
                line18.Linetype = Linetype.Dashed;
                line18.Lineweight = Lineweight.W25;
                dxf.AddEntity(line18);

                Line line19 = new Line(v46, v47);
                line19.Layer = refin;
                line19.Linetype = Linetype.Dashed;
                line19.Lineweight = Lineweight.W25;
                dxf.AddEntity(line19);

                Line line20 = new Line(v46, v47);
                line20.Layer = refin;
                line20.Linetype = Linetype.Dashed;
                line20.Lineweight = Lineweight.W25;
                dxf.AddEntity(line20);

                Line line21 = new Line(v48, v39);
                line21.Layer = refin;
                line21.Linetype = Linetype.Dashed;
                line21.Lineweight = Lineweight.W25;
                dxf.AddEntity(line21);

                Line line22 = new Line(v94, v95);
                line22.Layer = centre;
                line22.Linetype = Linetype.DashDot;
                line22.Lineweight = Lineweight.W25;
                dxf.AddEntity(line22);

                Line line23 = new Line(v96, v97);
                line23.Layer = centre;
                line23.Linetype = Linetype.DashDot;
                line23.Lineweight = Lineweight.W25;
                dxf.AddEntity(line23);

                Line line24 = new Line(v47, v48);
                line24.Layer = refin;
                line24.Linetype = Linetype.Dashed;
                line24.Lineweight = Lineweight.W25;
                dxf.AddEntity(line24);

                //填充
                LwPolyline hatchpoly1 = new LwPolyline();
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v50));
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v3));//0
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v9));//1
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v10));//2
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v11));//3
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v13));//4
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v14));//5
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v16));//6
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v17));//7
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(bu1));//8
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v66));//9
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(p1_1));//10
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(p2_1));//11
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(p3_1_1));//12
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(p4_1));//13
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(p5_1));//14
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(p6_1));//15
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v67));//16
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(bu2));//17
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v23));//18
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v24));//19
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v25));//20
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v26));//21
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v27));//22
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v28));//23
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v29));//24
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v36));//25
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v56));//26
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v55));//27
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v54));//28
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v53));//29
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v52));//30
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v51));//31
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v50));//32
                hatchpoly1.Vertexes[10].Bulge = -Math.Tan(40 * pi / 180 / 4);
                hatchpoly1.Vertexes[11].Bulge = Math.Tan(20 * pi / 180 / 4);
                hatchpoly1.Vertexes[12].Bulge = Math.Tan(20 * pi / 180 / 4);
                hatchpoly1.Vertexes[13].Bulge = Math.Tan(20 * pi / 180 / 4);
                hatchpoly1.Vertexes[14].Bulge = Math.Tan(20 * pi / 180 / 4);
                hatchpoly1.Vertexes[15].Bulge = Math.Tan(20 * pi / 180 / 4);
                hatchpoly1.Vertexes[27].Bulge = -Math.Tan(10 * pi / 180);
                hatchpoly1.Vertexes[28].Bulge = Math.Tan(10 * pi / 180);
                hatchpoly1.Vertexes[29].Bulge = Math.Tan(5 * pi / 180);
                hatchpoly1.Vertexes[30].Bulge = Math.Tan(10 * pi / 180);
                hatchpoly1.Vertexes[31].Bulge = -Math.Tan(10 * pi / 180);
                hatchpoly1.IsClosed = true;
                String[] htype1 = new String[100];
                Line[] hline1 = new Line[100];
                Arc[] harc1 = new Arc[100];
                int hnumst1 = hatchpoly1.Explode().Count;  //记录爆炸后，线段有多少
                for (int i = 0; i < hnumst1; i++)
                {
                    htype1[i] = hatchpoly1.Explode()[i].Type.ToString();    //将所有的元素记录成一个数组
                    if (htype1[i] == "Line")
                    {
                        hline1[i] = (Line)hatchpoly1.Explode()[i];
                    }
                    if (htype1[i] == "Arc")
                    {
                        harc1[i] = (Arc)hatchpoly1.Explode()[i];
                    }
                }
                fun.hatchsub1(dxf, htype1, hnumst1, 45, 10, hline1, harc1, hatching);

                //标注
                //标注样式
                //箭头样式
                DimensionStyle dimensionStyle = fun.CreateDimStyle();
                dimensionStyle.ArrowSize = 1;
                dimensionStyle.ExtLineExtend = 0.6;//标注延长线长度/2
                dimensionStyle.DimArrow1 = DimensionArrowhead.Closedfilled;
                dimensionStyle.DimArrow2 = DimensionArrowhead.Closedfilled;

                //文本样式
                dimensionStyle.TextHeight = 1;

                double e1 = fun.CalDistance(v57, v52) / 2;
                LinearDimension dim1 = new LinearDimension(new Line(new Vector2(v51_1.X, v51_1.Y + fun.CalDistance(v51, v52) / 2), v44), fun.CalDistance(v4, v5), 90, dimensionStyle);
                dim1.UserText = "e1=" + Math.Round(e1 * scale, 1);
                dxf.AddEntity(dim1);
                LinearDimension dim2 = new LinearDimension(new Line(new Vector2(v51_2.X, v51_2.Y - fun.CalDistance(v51, v52) / 2), v44), fun.CalDistance(v4, v5), 90, dimensionStyle);
                dim2.UserText = "e1=" + Math.Round(e1 * scale, 1);
                dxf.AddEntity(dim2);

                //线段尺寸标注
                //1_1
                LinearDimension dim1_1 = new LinearDimension(new Line(v1, p3_1), d6, 0, dimensionStyle);
                dim1_1.UserText = "l1=" + Math.Round(l1 * scale, 1);
                dxf.AddEntity(dim1_1);

                LinearDimension dim2_1 = new LinearDimension(new Line(v39, v45), d6 - d6 / 2, 180, dimensionStyle);
                dim2_1.UserText = "l3=" + Math.Round(l3 * scale, 1);
                dxf.AddEntity(dim2_1);

                LinearDimension dim4 = new LinearDimension(new Line(v1, v41), d6 - d6 / 6 * 3, 0, dimensionStyle);
                dim4.UserText = "l4=" + Math.Round(l4 * scale, 1);
                dxf.AddEntity(dim4);

                LinearDimension dim5 = new LinearDimension(new Line(p3_1, new Vector2(bu1_1.X - fun.CalDistance(bu1, bu1_1) / 6, bu1.Y)), d6 - (bu1_1.Y - v3.Y), 0, dimensionStyle);
                dim5.UserText = "e=" + Math.Round(e * scale, 1);
                dxf.AddEntity(dim5);

                LinearDimension dim6 = new LinearDimension(new Line(p3_1, v17), d6 - d6 / 6 * 2 - (bu1_1.Y - v3.Y), 0, dimensionStyle);
                dim6.UserText = "u=" + Math.Round(u * scale, 1);
                dxf.AddEntity(dim6);

                double f = fun.CalDistance(v11, v17);
                LinearDimension dim7 = new LinearDimension(new Line(v10, v17), d6 - d6 / 6 * 3 - (v10.Y - v1.Y), 0, dimensionStyle);
                dim7.UserText = "(f)=" + Math.Round(f * scale, 1);
                dxf.AddEntity(dim7);

                LinearDimension dim8 = new LinearDimension(new Line(p3_1, v10), d6 - d6 / 6 * 4 - (v10.Y - v3.Y), 0, dimensionStyle);
                dim8.UserText = "y=" + Math.Round(y * scale, 1);
                dxf.AddEntity(dim8);

                LinearDimension dim10 = new LinearDimension(new Line(v17, v23), l1 * 1.3 - (v17.X - v10.X), -90, dimensionStyle);
                dim10.UserText = "φd5=" + Math.Round(d5 * scale, 1);
                dxf.AddEntity(dim10);

                LinearDimension dim11 = new LinearDimension(new Line(v14, v25), l1 * 1.2 - (v17.X - v10.X), -90, dimensionStyle);
                dim11.UserText = "φd4=" + Math.Round(d4 * scale, 1);
                dxf.AddEntity(dim11);

                LinearDimension dim12 = new LinearDimension(new Line(bu1, bu2), l1 * 0.8 - (v17.X - v10.X), -90, dimensionStyle);
                dim12.UserText = "φd3=" + Math.Round(d3 * scale, 1);
                dxf.AddEntity(dim12);

                LinearDimension dim23 = new LinearDimension(new Line(p3_1, p3_2), fun.CalDistance(v4, v5), -90, dimensionStyle);
                dim23.UserText = "φd1=" + Math.Round(d1 * scale, 1);
                dxf.AddEntity(dim23);

                Vector2 bzd = new Vector2(v51_1.X, v51_1.Y + fun.CalDistance(v51, v52) / 2);
                fun.jdbz1(dxf, new Line(bzd, fun.Polar(bzd, pi, 0.1)), new Line(bzd, fun.Polar(bzd, 135 * pi / 180, 0.1)), 20, "≤35°", 3);

                //第2部分
                Vector2 v98_1 = new Vector2(v95.X + l1, v95.Y);
                Vector2 v99 = new Vector2(v98_1.X + l5 * 4, v98_1.Y);
                Vector2 v102 = new Vector2(v98_1.X + fun.CalDistance(v98_1, v99) / 2, v98_1.Y);
                Vector2 v100 = new Vector2(v102.X, v102.Y + fun.CalDistance(v98_1, v99) / 2);
                Vector2 v101 = new Vector2(v102.X, v102.Y - fun.CalDistance(v98_1, v99) / 2);
                Vector2 v103 = new Vector2(v102.X - Math.Tan(Math.Acos(b / 2 / (d5 / 2))) * b / 2, v102.Y + b / 2);
                Vector2 v105 = new Vector2(v102.X - l5, v103.Y - l7);
                Vector2 v104 = new Vector2(v105.X - l7, v103.Y);
                Vector2 v110 = new Vector2(v103.X, -v103.Y);
                Vector2 v106 = new Vector2(v105.X, -v105.Y);
                Vector2 v107 = new Vector2(v104.X, -v104.Y);
                Vector2 v118 = new Vector2(v102.X + Math.Tan(Math.Acos(b / 2 / (d5 / 2))) * b / 2, v102.Y + b / 2);
                Vector2 v115 = new Vector2(v102.X + l6, v118.Y - l7);
                Vector2 v116 = new Vector2(v115.X + l7, v115.Y + l7);
                Vector2 v111 = new Vector2(v118.X, -v118.Y);
                Vector2 v113 = new Vector2(v116.X, -v116.Y);
                Vector2 v114 = new Vector2(v115.X, -v115.Y);

                Vector2 v103_r = fun.rotatePoint_Changed(v102, v103, 90);
                Vector2 v104_r = fun.rotatePoint_Changed(v102, v104, 90);
                Vector2 v105_r = fun.rotatePoint_Changed(v102, v105, 90);
                Vector2 v106_r = fun.rotatePoint_Changed(v102, v106, 90);
                Vector2 v107_r = fun.rotatePoint_Changed(v102, v107, 90);
                Vector2 v110_r = fun.rotatePoint_Changed(v102, v110, 90);
                Vector2 v118_r = fun.rotatePoint_Changed(v102, v118, 90);
                Vector2 v116_r = fun.rotatePoint_Changed(v102, v116, 90);
                Vector2 v115_r = fun.rotatePoint_Changed(v102, v115, 90);
                Vector2 v111_r = fun.rotatePoint_Changed(v102, v111, 90);
                Vector2 v113_r = fun.rotatePoint_Changed(v102, v113, 90);
                Vector2 v114_r = fun.rotatePoint_Changed(v102, v114, 90);
                Vector2 v100_r = fun.rotatePoint_Changed(v102, v100, 90);
                Vector2 v101_r = fun.rotatePoint_Changed(v102, v101, 90);
                Vector2 v98_1_r = fun.rotatePoint_Changed(v102, v98_1, 90);
                Vector2 v99_r = fun.rotatePoint_Changed(v102, v99, 90);

                //作图
                fun.drawcircle(dxf, v102, fun.CalDistance(v42, v46) / 2, 0.3, contour);
                fun.drawcircle(dxf, v102, fun.CalDistance(v41, v47) / 2, 0.01, contour);
                fun.drawcircle(dxf, v102, fun.CalDistance(v49, v39) / 2, 0.01, contour);
                fun.drawcircle(dxf, v102, l5, 0.3, contour);
                fun.drawcircle(dxf, v102, fun.CalDistance(v2, v37) / 2, 0.3, contour);

                LwPolyline ddx1 = new LwPolyline();
                ddx1.Vertexes.Add(new LwPolylineVertex(v103_r));
                ddx1.Vertexes.Add(new LwPolylineVertex(v104_r));//0
                ddx1.Vertexes.Add(new LwPolylineVertex(v105_r));//1
                ddx1.Vertexes.Add(new LwPolylineVertex(v106_r));//2
                ddx1.Vertexes.Add(new LwPolylineVertex(v107_r));//3
                ddx1.Vertexes.Add(new LwPolylineVertex(v110_r));//4
                ddx1.Vertexes.Add(new LwPolylineVertex(v111_r));//5
                ddx1.Vertexes.Add(new LwPolylineVertex(v113_r));//6
                ddx1.Vertexes.Add(new LwPolylineVertex(v114_r));//7
                ddx1.Vertexes.Add(new LwPolylineVertex(v115_r));//8
                ddx1.Vertexes.Add(new LwPolylineVertex(v116_r));//9
                ddx1.Vertexes.Add(new LwPolylineVertex(v118_r));//10
                ddx1.Vertexes.Add(new LwPolylineVertex(v103_r));//11
                ddx1.Vertexes[1].Bulge = -Math.Tan(90 * pi / 180 / 4);
                ddx1.Vertexes[3].Bulge = -Math.Tan(90 * pi / 180 / 4);
                ddx1.Vertexes[5].Bulge = Math.Tan(Math.Acos(b / 2 / (d5 / 2)) * 2 / 4);
                ddx1.Vertexes[7].Bulge = -Math.Tan(90 * pi / 180 / 4);
                ddx1.Vertexes[9].Bulge = -Math.Tan(90 * pi / 180 / 4);
                ddx1.Vertexes[11].Bulge = Math.Tan(Math.Acos(b / 2 / (d5 / 2)) * 2 / 4);
                fun.PolyFill(dxf, ddx1, 0.3, contour);

                Line centreline1_2_1 = new Line(v98_1_r, v99_r);
                centreline1_2_1.Linetype = Linetype.Center;
                centreline1_2_1.Lineweight = Lineweight.W25;
                centreline1_2_1.Layer = centre;
                dxf.AddEntity(centreline1_2_1);

                Line centreline1_2_2 = new Line(v100_r, v101_r);
                centreline1_2_2.Linetype = Linetype.Center;
                centreline1_2_2.Lineweight = Lineweight.W25;
                centreline1_2_2.Layer = centre;
                dxf.AddEntity(centreline1_2_2);

                //标注
                fun.jdbz1(dxf, new Line(v102, new Vector2(v102.X - 0.1, v102.Y)), new Line(v102, fun.Polar(v102, 160 * pi / 180, 0.1)), 25, "20°", 3);

                LinearDimension dim13 = new LinearDimension(new Line(v105_r, v102), b * 2, 90, dimensionStyle);
                dim13.UserText = "l5=" + Math.Round(l5 * scale, 1);
                dxf.AddEntity(dim13);

                LinearDimension dim14 = new LinearDimension(new Line(v102, v115_r), b * 2, 90, dimensionStyle);
                dim14.UserText = "l6=" + Math.Round(l6 * scale, 1);
                dxf.AddEntity(dim14);

                LinearDimension dim15 = new LinearDimension(new Line(v118_r, v111_r), b * 2, 0, dimensionStyle);
                dim15.UserText = "2×b=" + Math.Round(b * scale, 1);
                dxf.AddEntity(dim15);

                LinearDimension dim16 = new LinearDimension(new Line(v118_r, v115_r), b, 0, dimensionStyle);
                dim16.UserText = "4×l7b=" + Math.Round(l7 * scale, 1);
                dxf.AddEntity(dim16);

                //公差
                fun.gcbz(dxf, new Vector2(v1.X, v1.Y + d6), 10, 180, 0.1, 180, 5, 1, 1, "A", "0.02", 2, "ytd", 1);
                fun.gcbz(dxf, new Vector2(v23.X + l1 * 1.3 - (v17.X - v10.X) - 2, v23.Y), 10, -90, 5, 180, 5, 1, 1, "A", "0.05", 2, "ytd", 1);
                fun.gcbz(dxf, new Vector2(v111_r.X, v111_r.Y + b * 2 - 2), 10, 0, 0.1, 0, 5, 1, 1, "A", "t3", 2, "dcd", 0.5);
            }

            //J型柄
            if (ctrap == 4)
            {
                //坐标
                Vector2 v6 = new Vector2(v5.X, v5.Y - 1 * scale);
                Vector2 v7 = new Vector2(v6.X + y / 3, v6.Y);
                Vector2 v8 = new Vector2(v7.X, v7.Y + 1 * scale);
                Vector2 v9 = new Vector2(v8.X + y / 3, v8.Y);
                Vector2 v10 = new Vector2(v9.X, d5 / 2);
                Vector2 v11 = new Vector2(v10.X + (u - y) * 1 / 2, v10.Y);
                Vector2 v12 = new Vector2(v11.X + (d5 - d4) / 2 * Math.Tan(30 * pi / 180), v11.Y - (d5 - d4) / 2);
                Vector2 v13 = new Vector2(v12.X, v12.Y);
                Vector2 v14 = new Vector2(v13.X + (u - y) * 1 / 4, v13.Y);
                Vector2 v15 = new Vector2(v14.X + (d5 - d4) / 2 * Math.Tan(30 * pi / 180), v14.Y + (d5 - d4) / 2);
                Vector2 v16 = new Vector2(v14.X + (d5 - d4) / 2 * Math.Tan(30 * pi / 180), v14.Y + (d5 - d4) / 2);
                Vector2 v17 = new Vector2(v16.X + (u - y) * 1 / 4, v16.Y);
                Vector2 v18 = new Vector2(v17.X, v17.Y - (d5 / 2 - (d5 - d3)));
                Vector2 v21 = new Vector2(v18.X, -v18.Y);
                Vector2 v23 = new Vector2(v17.X, -v17.Y);
                Vector2 v22 = new Vector2(v21.X, v21.Y - fun.CalDistance(v21, v23) / 3);
                Vector2 v24 = new Vector2(v16.X, -v16.Y);
                Vector2 v25 = new Vector2(v14.X, -v14.Y);
                Vector2 v26 = new Vector2(v13.X, -v13.Y);
                Vector2 v27 = new Vector2(v11.X, -v11.Y);
                Vector2 v28 = new Vector2(v10.X, -v10.Y);
                Vector2 v29 = new Vector2(v9.X, -v9.Y);
                Vector2 v30 = new Vector2(v8.X, -v8.Y);
                Vector2 v31 = new Vector2(v7.X, -v7.Y);
                Vector2 v32 = new Vector2(v6.X, -v6.Y);
                Vector2 v33 = new Vector2(v5.X, -v5.Y);
                Vector2 v34 = new Vector2(v4.X, -v4.Y);
                Vector2 v35 = new Vector2(v3.X, -v3.Y);
                Vector2 v37 = new Vector2(v2.X, -v2.Y);
                Vector2 v38 = new Vector2(v1.X, -v1.Y);
                Vector2 v49 = new Vector2(v1.X, d11 / 2);
                Vector2 v39 = new Vector2(v49.X, -v49.Y);
                Vector2 v40 = new Vector2(v49.X + Math.Cos(45 * pi / 180) * r2, d2 / 2);
                Vector2 v41 = new Vector2(v40.X + (l4 - Math.Cos(45 * pi / 180) * r2), v40.Y);
                Vector2 v42 = fun.Polar(v41, -45 * pi / 180, r2);
                Vector2 v98 = new Vector2(v41.X + (l2 - l4), v42.Y);
                Vector2 v43 = new Vector2(v1.X + l3, v42.Y);
                Vector2 v44 = new Vector2(v43.X + v43.Y / 2, v94.Y);
                Vector2 v45 = new Vector2(v43.X, -v43.Y);
                Vector2 v46 = new Vector2(v42.X, -v42.Y);
                Vector2 v47 = new Vector2(v41.X, -v41.Y);
                Vector2 v48 = new Vector2(v40.X, -v40.Y);
                Vector2 v36 = fun.Polar(v35, ((180 - Math.Atan((v3.Y - v2.Y) / (v3.X - v2.X)) * 180 / pi)) * pi / 180, l1 * 1 / 4 / Math.Cos(α));
                Vector2 v50 = new Vector2(v36.X, -v36.Y);
                Vector2 v51 = new Vector2(v50.X, v50.Y - d1 * 1 / 8);
                Vector2 v52 = fun.Polar(v51, -70 * pi / 180, fun.CalDistance(v43, v44) * 2 / 3);
                Vector2 v53 = fun.Polar(v52, -60 * pi / 180, fun.CalDistance(v43, v44) * 1 / 3);
                Vector2 v54 = new Vector2(v53.X, -v53.Y);
                Vector2 v55 = new Vector2(v52.X, -v52.Y);
                Vector2 v56 = new Vector2(v51.X, -v51.Y);
                Vector2 v96 = new Vector2(v13.X + fun.CalDistance(v13, v14) / 2, v13.Y + (d5 / 2 - d4 / 2) * 4);
                Vector2 v97 = new Vector2(v96.X, v27.Y - (d5 / 2 - d4 / 2) * 4);
                Vector2 v57_1 = new Vector2(v13.X - Math.Sin(30 * pi / 180) * fun.CalDistance(v11, v13) / 2, v13.Y + fun.CalDistance(v13, v14) / 2 / Math.Tan(30 * pi / 180));
                Vector2 v57_2 = new Vector2(v14.X + Math.Sin(30 * pi / 180) * fun.CalDistance(v11, v13) / 2, v14.Y + fun.CalDistance(v13, v14) / 2 / Math.Tan(30 * pi / 180));//切点
                Vector2 v57 = new Vector2(v96.X, v57_1.Y + fun.CalDistance(v57_1, v57_2) / 2 / Math.Tan(60 * pi / 180));
                Vector2 v58 = new Vector2(v57.X, v94.Y);
                Vector2 v59 = new Vector2(v57.X, -v57.Y);
                Vector2 bu1 = new Vector2(v18.X, v17.Y - (v17.Y - v14.Y) * 2);
                Vector2 bu1_1 = new Vector2(bu1.X + e / 3, bu1.Y);
                Vector2 bu2 = new Vector2(bu1.X, -bu1.Y);
                Vector2 bu2_1 = new Vector2(bu1_1.X, -bu1_1.Y);
                Vector2 bu3 = new Vector2(bu1_1.X, bu1_1.Y - fun.CalAngle(bu1_1, bu2_1) / 3);
                Vector2 bu4 = fun.Polar(bu3, -105 * pi / 180, fun.CalAngle(bu1_1, bu2_1) / 5);
                Vector2 bu5 = new Vector2(bu4.X - fun.CalAngle(bu1_1, bu2_1) / 8, v94.Y);
                Vector2 bu6 = new Vector2(bu3.X, -bu3.Y);
                Vector2 bu7 = new Vector2(bu4.X, -bu4.Y);
                Vector2 v65 = fun.Inters(v18, new Vector2(v18.X - l1, v18.Y), v10, v28);
                Vector2 v66 = new Vector2(v65.X, v65.Y - d12 / 6);
                Vector2 v67 = new Vector2(v66.X, -v66.Y);
                Vector2 v68 = new Vector2(v65.X, -v65.Y);
                Vector2 p1 = fun.Inters(v11, new Vector2(v11.X, v11.Y - l1), v65, new Vector2(v65.X + l1, v65.Y));
                Vector2 p1_1 = new Vector2(p1.X, p1.Y);

                //新增点
                Vector2 add1 = fun.Inters(v65, v18, v96, v97);
                Vector2 add2 = fun.Inters(v66, new Vector2(v66.X + l1, v66.Y), v96, v97);
                Vector2 add1_1 = new Vector2(add1.X, -add1.Y);
                Vector2 add2_1 = new Vector2(add2.X, -add2.Y);
                Vector2 add3 = fun.Inters(v11, new Vector2(v11.X, v11.Y - l1), v65, v18);
                Vector2 add3_1 = new Vector2(add3.X, -add3.Y);

                //作图
                LwPolyline Arc1 = new LwPolyline();
                Arc1.Vertexes.Add(new LwPolylineVertex(v1));
                Arc1.Vertexes.Add(new LwPolylineVertex(v2));//0
                Arc1.Vertexes[0].Bulge = -Math.Tan((90 - (Math.Atan(7 / 24) * 180 / pi)) * pi / 180 / 4);
                fun.PolyFill(dxf, Arc1, 0.3, contour);

                Vector2[] Line2 = { v2, v3 };
                fun.drawBLine(dxf, Line2, 0.3, contour);

                LwPolyline poly1 = new LwPolyline();
                poly1.Vertexes.Add(new LwPolylineVertex(v3));
                poly1.Vertexes.Add(new LwPolylineVertex(v4));
                poly1.Vertexes.Add(new LwPolylineVertex(v5));
                poly1.Vertexes.Add(new LwPolylineVertex(v6));
                poly1.Vertexes.Add(new LwPolylineVertex(v7));
                poly1.Vertexes.Add(new LwPolylineVertex(v8));
                poly1.Vertexes.Add(new LwPolylineVertex(v9));
                poly1.Vertexes.Add(new LwPolylineVertex(v10));
                poly1.Vertexes.Add(new LwPolylineVertex(v11));
                poly1.Vertexes.Add(new LwPolylineVertex(v12));
                poly1.Vertexes.Add(new LwPolylineVertex(v13));
                poly1.Vertexes.Add(new LwPolylineVertex(v14));
                poly1.Vertexes.Add(new LwPolylineVertex(v16));
                poly1.Vertexes.Add(new LwPolylineVertex(v17));
                poly1.Vertexes.Add(new LwPolylineVertex(v23));
                fun.PolyFill(dxf, poly1, 0.3, contour);

                LwPolyline poly2 = new LwPolyline();
                poly2.Vertexes.Add(new LwPolylineVertex(v23));
                poly2.Vertexes.Add(new LwPolylineVertex(v24));
                poly2.Vertexes.Add(new LwPolylineVertex(v25));
                poly2.Vertexes.Add(new LwPolylineVertex(v26));
                poly2.Vertexes.Add(new LwPolylineVertex(v27));
                poly2.Vertexes.Add(new LwPolylineVertex(v28));
                poly2.Vertexes.Add(new LwPolylineVertex(v29));
                poly2.Vertexes.Add(new LwPolylineVertex(v30));
                poly2.Vertexes.Add(new LwPolylineVertex(v31));
                poly2.Vertexes.Add(new LwPolylineVertex(v32));
                poly2.Vertexes.Add(new LwPolylineVertex(v33));
                poly2.Vertexes.Add(new LwPolylineVertex(v34));
                poly2.Vertexes.Add(new LwPolylineVertex(v35));
                poly2.Vertexes.Add(new LwPolylineVertex(v37));
                poly2.Vertexes.Add(new LwPolylineVertex(v38));//13
                poly2.Vertexes.Add(new LwPolylineVertex(v1));
                poly2.Vertexes[13].Bulge = -Math.Tan((90 - (Math.Atan(7 / 24) * 180 / pi)) * pi / 180 / 4);
                fun.PolyFill(dxf, poly2, 0.3, contour);

                LwPolyline poly3 = new LwPolyline();
                poly3.Vertexes.Add(new LwPolylineVertex(v49));
                poly3.Vertexes.Add(new LwPolylineVertex(v40));
                poly3.Vertexes.Add(new LwPolylineVertex(v41));
                poly3.Vertexes.Add(new LwPolylineVertex(v42));
                poly3.Vertexes.Add(new LwPolylineVertex(v43));
                poly3.Vertexes.Add(new LwPolylineVertex(v44));
                poly3.Vertexes.Add(new LwPolylineVertex(v45));
                poly3.Vertexes.Add(new LwPolylineVertex(v46));
                poly3.Vertexes.Add(new LwPolylineVertex(v47));
                poly3.Vertexes.Add(new LwPolylineVertex(v48));
                poly3.Vertexes.Add(new LwPolylineVertex(v39));
                fun.PolyFill(dxf, poly3, 0.3, contour);

                Vector2[] Line3 = { v40, v48 };
                fun.drawBLine(dxf, Line3, 0.3, contour);

                Vector2[] Line4 = { v41, v47 };
                fun.drawBLine(dxf, Line4, 0.3, contour);

                Vector2[] Line5 = { v42, v46 };
                fun.drawBLine(dxf, Line5, 0.3, contour);

                Vector2[] Line6 = { v43, v45 };
                fun.drawBLine(dxf, Line6, 0.3, contour);

                Vector2[] Line7 = { v4, v34 };
                fun.drawBLine(dxf, Line7, 0.3, contour);

                Vector2[] Line8 = { v6, v32 };
                fun.drawBLine(dxf, Line8, 0.3, contour);

                Vector2[] Line9 = { v7, v31 };
                fun.drawBLine(dxf, Line9, 0.3, contour);

                Vector2[] Line10 = { v9, v29 };
                fun.drawBLine(dxf, Line10, 0.3, contour);

                LwPolyline poly4 = new LwPolyline();
                poly4.Vertexes.Add(new LwPolylineVertex(v50));
                poly4.Vertexes.Add(new LwPolylineVertex(v51));//0
                poly4.Vertexes.Add(new LwPolylineVertex(v52));//1
                poly4.Vertexes.Add(new LwPolylineVertex(v53));//2
                poly4.Vertexes.Add(new LwPolylineVertex(v54));//3
                poly4.Vertexes.Add(new LwPolylineVertex(v55));//4
                poly4.Vertexes.Add(new LwPolylineVertex(v56));//5
                poly4.Vertexes.Add(new LwPolylineVertex(v36));//6
                poly4.Vertexes[1].Bulge = Math.Tan(10 * pi / 180);
                poly4.Vertexes[2].Bulge = -Math.Tan(10 * pi / 180);
                poly4.Vertexes[3].Bulge = -Math.Tan(5 * pi / 180);
                poly4.Vertexes[4].Bulge = -Math.Tan(10 * pi / 180);
                poly4.Vertexes[5].Bulge = Math.Tan(10 * pi / 180);
                fun.PolyFill(dxf, poly4, 0.1, additionalline);

                Vector2 p8 = fun.Inters(v98, new Vector2(v98.X, v98.Y - l1), v45, v46);
                Vector2 p8_1 = fun.Inters(v41, new Vector2(v41.X + l1, v41.Y), v98, new Vector2(v98.X, v98.Y + l1));
                Vector2 p8_2 = fun.Inters(v47, new Vector2(v47.X + l1, v47.Y), v98, new Vector2(v98.X, v98.Y - l1));
                LwPolyline poly6 = new LwPolyline();
                poly6.Vertexes.Add(new LwPolylineVertex(v41));
                poly6.Vertexes.Add(new LwPolylineVertex(p8_1));
                poly6.Vertexes.Add(new LwPolylineVertex(v98));
                poly6.Linetype = Linetype.Dashed;
                poly6.Layer = refin;
                poly6.Lineweight = Lineweight.W20;
                dxf.AddEntity(poly6);

                LwPolyline poly7 = new LwPolyline();
                poly7.Vertexes.Add(new LwPolylineVertex(p8));
                poly7.Vertexes.Add(new LwPolylineVertex(p8_2));
                poly7.Vertexes.Add(new LwPolylineVertex(v47));
                poly7.Linetype = Linetype.Dashed;
                poly7.Layer = refin;
                poly7.Lineweight = Lineweight.W20;
                dxf.AddEntity(poly7);

                Vector2[] Line1 = { v98, p8 };
                fun.drawBLine(dxf, Line1, 0.3, contour);

                Line Line25 = new Line(v94, v95);
                Line25.Lineweight = Lineweight.W25;
                Line25.Layer = centre;
                Line25.Linetype = Linetype.Center;
                dxf.AddEntity(Line25);

                Line Line26 = new Line(v96, v97);
                Line26.Lineweight = Lineweight.W25;
                Line26.Layer = centre;
                Line26.Linetype = Linetype.Center;
                dxf.AddEntity(Line26);

                LwPolyline Arc2 = new LwPolyline();
                Arc2.Vertexes.Add(new LwPolylineVertex(add1));
                Arc2.Vertexes.Add(new LwPolylineVertex(add1_1));//0
                Arc2.Vertexes[0].Bulge = -Math.Tan(pi / 4);
                fun.PolyFill(dxf, Arc2, 0.3, contour);
                Arc arc2 = new Arc(v58, fun.CalDistance(v58, add1), 90, -90);

                LwPolyline Arc3 = new LwPolyline();
                Arc3.Vertexes.Add(new LwPolylineVertex(add2));
                Arc3.Vertexes.Add(new LwPolylineVertex(add2_1));//0
                Arc3.Vertexes[0].Bulge = -Math.Tan(pi / 4);
                fun.PolyFill(dxf, Arc3, 0.3, contour);
                Arc arc3 = new Arc(v58, fun.CalDistance(v58, add2), 90, -90);

                Vector2[] Line11 = { v65, add1 };
                fun.drawBLine(dxf, Line11, 0.3, contour);

                Vector2[] Line12 = { v68, add1_1 };
                fun.drawBLine(dxf, Line12, 0.3, contour);

                Vector2[] Line13 = { v66, add2 };
                fun.drawBLine(dxf, Line13, 0.3, contour);

                Vector2[] Line14 = { v67, add2_1 };
                fun.drawBLine(dxf, Line14, 0.3, contour);

                Vector2 p2 = fun.getPointForArcandLine(v16, new Vector2(v16.X, v16.Y - l1), v58, arc2);
                Vector2 p2_1 = new Vector2(p2.X, -p2.Y);

                Vector2[] Line15 = { v16, p2_1 };
                fun.drawBLine(dxf, Line15, 0.3, contour);

                Vector2[] Line16 = { v24, p2 };
                fun.drawBLine(dxf, Line16, 0.3, contour);

                Vector2[] Line17 = { v11, add3 };
                fun.drawBLine(dxf, Line17, 0.3, contour);

                Vector2[] Line18 = { v27, add3_1 };
                fun.drawBLine(dxf, Line18, 0.3, contour);

                LwPolyline hatchpoly1 = new LwPolyline();
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v50));
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v51));//0
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v52));//1
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v53));//2
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v54));//3
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v55));//4
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v56));//5
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v36));//6
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v37));//7
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v38));//8
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v39));//9
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v48));//10
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v47));//11
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v46));//12
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v45));//13
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v44));//14
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v43));//15
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v42));//16
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v41));//17
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v40));//18
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v49));//19
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v1));//20
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v2));//21
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v50));//22
                hatchpoly1.Vertexes[1].Bulge = Math.Tan(10 * pi / 180);
                hatchpoly1.Vertexes[2].Bulge = -Math.Tan(10 * pi / 180);
                hatchpoly1.Vertexes[3].Bulge = -Math.Tan(5 * pi / 180);
                hatchpoly1.Vertexes[4].Bulge = -Math.Tan(10 * pi / 180);
                hatchpoly1.Vertexes[5].Bulge = Math.Tan(10 * pi / 180);
                hatchpoly1.Vertexes[8].Bulge = -Math.Tan((90 - (Math.Atan(7 / 24) * 180 / pi)) * pi / 180 / 4);
                hatchpoly1.Vertexes[21].Bulge = -Math.Tan((90 - (Math.Atan(7 / 24) * 180 / pi)) * pi / 180 / 4);
                hatchpoly1.IsClosed = true;
                String[] htype1 = new String[100];
                Line[] hline1 = new Line[100];
                Arc[] harc1 = new Arc[100];
                int hnumst1 = hatchpoly1.Explode().Count;  //记录爆炸后，线段有多少
                for (int i = 0; i < hnumst1; i++)
                {
                    htype1[i] = hatchpoly1.Explode()[i].Type.ToString();    //将所有的元素记录成一个数组
                    if (htype1[i] == "Line")
                    {
                        hline1[i] = (Line)hatchpoly1.Explode()[i];
                    }
                    if (htype1[i] == "Arc")
                    {
                        harc1[i] = (Arc)hatchpoly1.Explode()[i];
                    }
                }
                fun.hatchsub1(dxf, htype1, hnumst1, 45, 10, hline1, harc1, hatching);

                //第2部分
                //点
                Vector2 v98_1 = new Vector2(v95.X + l1, v95.Y);
                Vector2 v99 = new Vector2(v98_1.X + l5 * 4, v98_1.Y);
                Vector2 v102 = new Vector2(v98_1.X + fun.CalDistance(v98_1, v99) / 2, v98_1.Y);
                Vector2 v100 = new Vector2(v102.X, v102.Y + fun.CalDistance(v98_1, v99) / 2);
                Vector2 v101 = new Vector2(v102.X, v102.Y - fun.CalDistance(v98_1, v99) / 2);
                Vector2 v103 = new Vector2(v102.X - Math.Tan(Math.Acos(b / 2 / (d5 / 2))) * b / 2, v102.Y + b / 2);
                Vector2 v105 = new Vector2(v102.X - l6, v103.Y - l7);
                Vector2 v104 = new Vector2(v105.X - l7, v103.Y);
                Vector2 v110 = new Vector2(v103.X, -v103.Y);
                Vector2 v106 = new Vector2(v105.X, -v105.Y);
                Vector2 v107 = new Vector2(v104.X, -v104.Y);
                Vector2 v118 = new Vector2(v102.X + Math.Tan(Math.Acos(b / 2 / (d5 / 2))) * b / 2, v102.Y + b / 2);
                Vector2 v115 = new Vector2(v102.X + l6, v118.Y - l7);
                Vector2 v116 = new Vector2(v115.X + l7, v115.Y + l7);
                Vector2 v111 = new Vector2(v118.X, -v118.Y);
                Vector2 v113 = new Vector2(v116.X, -v116.Y);
                Vector2 v114 = new Vector2(v115.X, -v115.Y);

                Arc arc1_2_1 = new Arc(v102, fun.CalDistance(v102, v103), 0, -90);
                Vector2 v113_1 = fun.getPointForArcandLine(v113, new Vector2(v113.X, v113.Y - l1), v102, arc1_2_1);
                Vector2 v113_3 = fun.mirrorpoint(v113_1, v102, fun.Polar(v102, -45 * pi / 180, 10));
                Vector2 v113_2 = new Vector2(v102.X + j, v113_1.Y);

                //作图
                fun.drawcircle(dxf, v102, fun.CalDistance(v42, v46) / 2, 0.3, contour);
                fun.drawcircle(dxf, v102, fun.CalDistance(v41, v47) / 2, 0.01, contour);
                fun.drawcircle(dxf, v102, fun.CalDistance(v49, v39) / 2, 0.01, contour);
                fun.drawcircle(dxf, v102, l6, 0.3, contour);
                fun.drawcircle(dxf, v102, fun.CalDistance(v2, v37) / 2, 0.3, contour);
                fun.drawcircle(dxf, v102, d5 / 2, 0.3, contour);

                LwPolyline ddx1 = new LwPolyline();
                ddx1.Vertexes.Add(new LwPolylineVertex(v103));
                ddx1.Vertexes.Add(new LwPolylineVertex(v104));//0
                ddx1.Vertexes.Add(new LwPolylineVertex(v105));//1
                ddx1.Vertexes.Add(new LwPolylineVertex(v106));//2
                ddx1.Vertexes.Add(new LwPolylineVertex(v107));//3
                ddx1.Vertexes.Add(new LwPolylineVertex(v110));//4
                ddx1.Vertexes.Add(new LwPolylineVertex(v111));//5
                ddx1.Vertexes.Add(new LwPolylineVertex(v113));//6
                ddx1.Vertexes.Add(new LwPolylineVertex(v114));//7
                ddx1.Vertexes.Add(new LwPolylineVertex(v115));//8
                ddx1.Vertexes.Add(new LwPolylineVertex(v116));//9
                ddx1.Vertexes.Add(new LwPolylineVertex(v118));//10
                ddx1.Vertexes.Add(new LwPolylineVertex(v103));//11
                ddx1.Vertexes[5].Bulge = Math.Tan(Math.Acos(b / 2 / (d5 / 2)) * 2 / 4);
                ddx1.Vertexes[11].Bulge = Math.Tan(Math.Acos(b / 2 / (d5 / 2)) * 2 / 4);
                fun.PolyFill(dxf, ddx1, 0.3, contour);

                Line centreline1_2_1 = new Line(v98_1, v99);
                centreline1_2_1.Linetype = Linetype.Center;
                centreline1_2_1.Lineweight = Lineweight.W25;
                centreline1_2_1.Layer = centre;
                dxf.AddEntity(centreline1_2_1);

                Line centreline1_2_2 = new Line(v100, v101);
                centreline1_2_2.Linetype = Linetype.Center;
                centreline1_2_2.Lineweight = Lineweight.W25;
                centreline1_2_2.Layer = centre;
                dxf.AddEntity(centreline1_2_2);

                Vector2[] Line19 = { v116, v113 };
                fun.drawBLine(dxf, Line19, 0.3, contour);

                Vector2[] Line20 = { v104, v107 };
                fun.drawBLine(dxf, Line20, 0.3, contour);

                //标注样式
                //箭头样式
                DimensionStyle dimensionStyle = fun.CreateDimStyle();
                dimensionStyle.ArrowSize = 1;
                dimensionStyle.ExtLineExtend = 0.6;//标注延长线长度/2
                dimensionStyle.DimArrow1 = DimensionArrowhead.Closedfilled;
                dimensionStyle.DimArrow2 = DimensionArrowhead.Closedfilled;

                //文本样式
                dimensionStyle.TextHeight = 1;

                //线段尺寸标注
                //1_1
                LinearDimension dim1 = new LinearDimension(new Line(v1, p3_1), d6, 0, dimensionStyle);
                dim1.UserText = "l1=" + Math.Round(l1 * scale, 1);
                dxf.AddEntity(dim1);

                LinearDimension dim2 = new LinearDimension(new Line(v1, v43), d6 - d6 / 6, 0, dimensionStyle);
                dim2.UserText = "l3=" + Math.Round(l3 * scale, 1);
                dxf.AddEntity(dim2);

                LinearDimension dim3 = new LinearDimension(new Line(v1, v98), d6 - d6 / 6 * 2, 0, dimensionStyle);
                dim3.UserText = "l2=" + Math.Round(l2 * scale, 1);
                dxf.AddEntity(dim3);

                LinearDimension dim4 = new LinearDimension(new Line(v1, v41), d6 - d6 / 6 * 3, 0, dimensionStyle);
                dim4.UserText = "l4=" + Math.Round(l4 * scale, 1);
                dxf.AddEntity(dim4);

                LinearDimension dim5 = new LinearDimension(new Line(p3_1, new Vector2(bu1_1.X - fun.CalDistance(bu1, bu1_1) / 6, bu1.Y)), d6 - (bu1_1.Y - v3.Y), 0, dimensionStyle);
                dim5.UserText = "e=" + Math.Round(e * scale, 1);
                dxf.AddEntity(dim5);

                LinearDimension dim6 = new LinearDimension(new Line(p3_1, v17), d6 - d6 / 6 * 2 - (bu1_1.Y - v3.Y), 0, dimensionStyle);
                dim6.UserText = "u=" + Math.Round(u * scale, 1);
                dxf.AddEntity(dim6);

                double f = fun.CalDistance(v11, v17);
                LinearDimension dim7 = new LinearDimension(new Line(v10, v17), d6 - d6 / 6 * 3 - (v10.Y - v1.Y), 0, dimensionStyle);
                dim7.UserText = "(f)=" + Math.Round(f * scale, 1);
                dxf.AddEntity(dim7);

                LinearDimension dim8 = new LinearDimension(new Line(p3_1, v10), d6 - d6 / 6 * 4 - (v10.Y - v3.Y), 0, dimensionStyle);
                dim8.UserText = "y=" + Math.Round(y * scale, 1);
                dxf.AddEntity(dim8);

                Vector2 bz1 = new Vector2(v57.X, v57.Y + fun.CalDistance(v57, v57_1));
                LinearDimension dim9 = new LinearDimension(new Line(bz1, fun.mirrorpoint(bz1, v94, v95)), l1 * 1.4, -90, dimensionStyle);
                dim9.UserText = "φd6=" + Math.Round(d6 * scale, 1);
                dxf.AddEntity(dim9);

                LinearDimension dim10 = new LinearDimension(new Line(v17, v23), l1 * 1.3 - (v17.X - v10.X), -90, dimensionStyle);
                dim10.UserText = "φd5=" + Math.Round(d5 * scale, 1);
                dxf.AddEntity(dim10);

                LinearDimension dim11 = new LinearDimension(new Line(v14, v25), l1 * 1.2 - (v17.X - v10.X), -90, dimensionStyle);
                dim11.UserText = "φd4=" + Math.Round(d4 * scale, 1);
                dxf.AddEntity(dim11);

                LinearDimension dim12 = new LinearDimension(new Line(bu1, bu2), l1 * 0.8 - (v17.X - v10.X), -90, dimensionStyle);
                dim12.UserText = "φd3=" + Math.Round(d3 * scale, 1);
                dxf.AddEntity(dim12);

                LinearDimension dim23 = new LinearDimension(new Line(p3_1, p3_2), fun.CalDistance(v4, v5), 90, dimensionStyle);
                dim23.UserText = "φd1=" + Math.Round(d1 * scale, 1);
                dxf.AddEntity(dim23);

                //1_2
                LinearDimension dim13 = new LinearDimension(new Line(v105, v102), b * 3, 0, dimensionStyle);
                dim13.UserText = "l6=" + Math.Round(l6 * scale, 1);
                dxf.AddEntity(dim13);

                LinearDimension dim14 = new LinearDimension(new Line(v102, v115), b * 3, 0, dimensionStyle);
                dim14.UserText = "l6=" + Math.Round(l6 * scale, 1);
                dxf.AddEntity(dim14);

                LinearDimension dim15 = new LinearDimension(new Line(v118, v111), b * 2, -90, dimensionStyle);
                dim15.UserText = "2×b=" + Math.Round(b * scale, 1);
                dxf.AddEntity(dim15);

                LinearDimension dim16 = new LinearDimension(new Line(v118, v115), b, -90, dimensionStyle);
                dim16.UserText = "4×l7b=" + Math.Round(l7 * scale, 1);
                dxf.AddEntity(dim16);

                //公差
                fun.gcbz(dxf, new Vector2(v1.X, v1.Y + d6), 10, 180, 0.1, 180, 5, 1, 1, "A", "0.02", 2, "ytd", 1);
                fun.gcbz(dxf, new Vector2(v23.X + l1 * 1.3 - (v17.X - v10.X) - 2, v23.Y), 10, -90, 5, 180, 5, 1, 1, "A", "0.05", 2, "ytd", 1);
                fun.gcbz(dxf, new Vector2(fun.mirrorpoint(bz1, v94, v95).X + l1 * 1.4 - 2, fun.mirrorpoint(bz1, v94, v95).Y), 15, -90, 10, 180, 5, 1, 1, "A", "0.05", 2, "ytd", 1);
                fun.gcbz(dxf, new Vector2(v111.X + b * 2 - 2, v111.Y), 20, -90, 5, 180, 5, 1, 1, "A", "t3", 2, "dcd", 0.5);
            }

            if (ctrap == 5)
            {
                Vector2 v6 = new Vector2(v5.X, v5.Y - 1 * scale);
                Vector2 v7 = new Vector2(v6.X + y / 3, v6.Y);
                Vector2 v8 = new Vector2(v7.X, v7.Y + 1 * scale);
                Vector2 v9 = new Vector2(v8.X + y / 3, v8.Y);
                Vector2 v10 = new Vector2(v9.X, d5 / 2);
                Vector2 v11 = new Vector2(v10.X + (u - y) * 1 / 2, v10.Y);
                Vector2 v12 = new Vector2(v11.X + (d5 - d4) / 2 * Math.Tan(30 * pi / 180), v11.Y - (d5 - d4) / 2);
                Vector2 v13 = new Vector2(v12.X, v12.Y);
                Vector2 v14 = new Vector2(v13.X + (u - y) * 1 / 4, v13.Y);
                Vector2 v15 = new Vector2(v14.X + (d5 - d4) / 2 * Math.Tan(30 * pi / 180), v14.Y + (d5 - d4) / 2);
                Vector2 v16 = new Vector2(v14.X + (d5 - d4) / 2 * Math.Tan(30 * pi / 180), v14.Y + (d5 - d4) / 2);
                Vector2 v17 = new Vector2(v16.X + (u - y) * 1 / 4, v16.Y);
                Vector2 v18 = new Vector2(v17.X, v17.Y - (v17.Y - v14.Y) * 2);
                Vector2 v19 = new Vector2(v18.X, -v18.Y);
                Vector2 v21 = new Vector2(v18.X, -v18.Y);
                Vector2 v23 = new Vector2(v17.X, -v17.Y);
                Vector2 v22 = new Vector2(v21.X, v21.Y - fun.CalDistance(v21, v23) / 3);
                Vector2 v24 = new Vector2(v16.X, -v16.Y);
                Vector2 v25 = new Vector2(v14.X, -v14.Y);
                Vector2 v26 = new Vector2(v13.X, -v13.Y);
                Vector2 v27 = new Vector2(v11.X, -v11.Y);
                Vector2 v28 = new Vector2(v10.X, -v10.Y);
                Vector2 v29 = new Vector2(v9.X, -v9.Y);
                Vector2 v30 = new Vector2(v8.X, -v8.Y);
                Vector2 v31 = new Vector2(v7.X, -v7.Y);
                Vector2 v32 = new Vector2(v6.X, -v6.Y);
                Vector2 v33 = new Vector2(v5.X, -v5.Y);
                Vector2 v34 = new Vector2(v4.X, -v4.Y);
                Vector2 v35 = new Vector2(v3.X, -v3.Y);
                Vector2 v37 = new Vector2(v2.X, -v2.Y);
                Vector2 v38 = new Vector2(v1.X, -v1.Y);
                Vector2 v49 = new Vector2(v1.X, d11 / 2);
                Vector2 v39 = new Vector2(v49.X, -v49.Y);
                Vector2 v40 = new Vector2(v49.X + Math.Cos(45 * pi / 180) * r2, d2 / 2);
                Vector2 v41 = new Vector2(v40.X + (l4 - Math.Cos(45 * pi / 180) * r2), v40.Y);
                Vector2 v42 = fun.Polar(v41, -45 * pi / 180, r2);
                Vector2 v98 = new Vector2(v41.X + (l2 - l4), v42.Y);
                Vector2 v46 = new Vector2(v42.X, -v42.Y);
                Vector2 v47 = new Vector2(v41.X, -v41.Y);
                Vector2 v48 = new Vector2(v40.X, -v40.Y);
                Vector2 v36 = fun.Polar(v35, ((180 - Math.Atan((v3.Y - v2.Y) / (v3.X - v2.X)) * 180 / pi)) * pi / 180, l1 * 1 / 4 / Math.Cos(α));
                Vector2 v50 = new Vector2(v36.X, -v36.Y);
                Vector2 v51 = new Vector2(v18.X + e / 3, v18.Y);
                Vector2 v52 = new Vector2(v51.X, -v51.Y);
                Vector2 v55 = new Vector2(v52.X, -v52.Y);
                Vector2 v56 = new Vector2(v51.X, -v51.Y);
                Vector2 v96 = new Vector2(v13.X + fun.CalDistance(v13, v14) / 2, v13.Y + (d5 / 2 - d4 / 2) * 4);
                Vector2 v97 = new Vector2(v96.X, v27.Y - (d5 / 2 - d4 / 2) * 4);
                Vector2 v57_1 = new Vector2(v13.X - Math.Sin(30 * pi / 180) * fun.CalDistance(v11, v13) / 2, v13.Y + fun.CalDistance(v13, v14) / 2 / Math.Tan(30 * pi / 180));
                Vector2 v57_2 = new Vector2(v14.X + Math.Sin(30 * pi / 180) * fun.CalDistance(v11, v13) / 2, v14.Y + fun.CalDistance(v13, v14) / 2 / Math.Tan(30 * pi / 180));//切点
                Vector2 v57 = new Vector2(v96.X, v57_1.Y + fun.CalDistance(v57_1, v57_2) / 2 / Math.Tan(60 * pi / 180));
                Vector2 v58 = new Vector2(v57.X, v94.Y);
                Vector2 v59 = new Vector2(v57.X, -v57.Y);
                Vector2 v43 = fun.Inters(v42, new Vector2(v42.X + l1 + e, v42.Y), v18, new Vector2(v18.X, v18.Y - l1));
                Vector2 v45 = new Vector2(v43.X, -v43.Y);
                Vector2 v53 = new Vector2(v43.X, v43.Y + fun.CalDistance(v43, v45) / 3);
                Vector2 v54 = new Vector2(v53.X, -v53.Y);

                //作图
                LwPolyline polyline1 = new LwPolyline();
                polyline1.Vertexes.Add(new LwPolylineVertex(v1));
                polyline1.Vertexes.Add(new LwPolylineVertex(v2));//0
                polyline1.Vertexes.Add(new LwPolylineVertex(v3));//1
                polyline1.Vertexes.Add(new LwPolylineVertex(v4));//2
                polyline1.Vertexes.Add(new LwPolylineVertex(v5));//3
                polyline1.Vertexes.Add(new LwPolylineVertex(v6));//4
                polyline1.Vertexes.Add(new LwPolylineVertex(v7));//5
                polyline1.Vertexes.Add(new LwPolylineVertex(v8));//6
                polyline1.Vertexes.Add(new LwPolylineVertex(v9));//7
                polyline1.Vertexes.Add(new LwPolylineVertex(v10));//8
                polyline1.Vertexes.Add(new LwPolylineVertex(v11));//9
                polyline1.Vertexes.Add(new LwPolylineVertex(v13));//10
                polyline1.Vertexes.Add(new LwPolylineVertex(v14));//11
                polyline1.Vertexes.Add(new LwPolylineVertex(v16));//12
                polyline1.Vertexes.Add(new LwPolylineVertex(v17));//13
                polyline1.Vertexes.Add(new LwPolylineVertex(v18));//14
                polyline1.Vertexes[0].Bulge = -Math.Tan((90 - (Math.Atan(7 / 24) * 180 / pi)) * pi / 180 / 4);
                fun.PolyFill(dxf, polyline1, 0.3, contour);

                LwPolyline polyline2 = new LwPolyline();
                polyline2.Vertexes.Add(new LwPolylineVertex(v19));
                polyline2.Vertexes.Add(new LwPolylineVertex(v23));//0
                polyline2.Vertexes.Add(new LwPolylineVertex(v24));
                polyline2.Vertexes.Add(new LwPolylineVertex(v25));
                polyline2.Vertexes.Add(new LwPolylineVertex(v26));
                polyline2.Vertexes.Add(new LwPolylineVertex(v27));
                polyline2.Vertexes.Add(new LwPolylineVertex(v28));
                polyline2.Vertexes.Add(new LwPolylineVertex(v29));
                polyline2.Vertexes.Add(new LwPolylineVertex(v30));
                polyline2.Vertexes.Add(new LwPolylineVertex(v31));
                polyline2.Vertexes.Add(new LwPolylineVertex(v32));
                polyline2.Vertexes.Add(new LwPolylineVertex(v33));
                polyline2.Vertexes.Add(new LwPolylineVertex(v34));
                polyline2.Vertexes.Add(new LwPolylineVertex(v35));
                polyline2.Vertexes.Add(new LwPolylineVertex(v37));
                polyline2.Vertexes.Add(new LwPolylineVertex(v38));//14
                polyline2.Vertexes.Add(new LwPolylineVertex(v1));
                polyline2.Vertexes[14].Bulge = -Math.Tan((90 - (Math.Atan(7 / 24) * 180 / pi)) * pi / 180 / 4);
                fun.PolyFill(dxf, polyline2, 0.3, contour);

                LwPolyline polyline3 = new LwPolyline();
                polyline3.Vertexes.Add(new LwPolylineVertex(v49));
                polyline3.Vertexes.Add(new LwPolylineVertex(v40));
                polyline3.Vertexes.Add(new LwPolylineVertex(v41));
                polyline3.Vertexes.Add(new LwPolylineVertex(v42));
                polyline3.Vertexes.Add(new LwPolylineVertex(v43));
                fun.PolyFill(dxf, polyline3, 0.3, contour);

                LwPolyline polyline4 = new LwPolyline();
                polyline4.Vertexes.Add(new LwPolylineVertex(v39));
                polyline4.Vertexes.Add(new LwPolylineVertex(v48));
                polyline4.Vertexes.Add(new LwPolylineVertex(v47));
                polyline4.Vertexes.Add(new LwPolylineVertex(v46));
                polyline4.Vertexes.Add(new LwPolylineVertex(v45));
                fun.PolyFill(dxf, polyline4, 0.3, contour);

                Vector2[] Line1 = { v40, v48 };
                fun.drawBLine(dxf, Line1, 0.3, contour);

                Vector2[] Line2 = { v41, v47 };
                fun.drawBLine(dxf, Line2, 0.3, contour);

                Vector2[] Line3 = { v42, v46 };
                fun.drawBLine(dxf, Line3, 0.3, contour);

                LwPolyline Arc1 = new LwPolyline();
                Arc1.Vertexes.Add(new LwPolylineVertex(v50));
                Arc1.Vertexes.Add(new LwPolylineVertex(v53));//0
                Arc1.Vertexes[0].Bulge = Math.Tan(40 * pi / 180 / 4);
                fun.PolyFill(dxf, Arc1, 0.3, contour);

                LwPolyline Arc2 = new LwPolyline();
                Arc2.Vertexes.Add(new LwPolylineVertex(v54));
                Arc2.Vertexes.Add(new LwPolylineVertex(v36));//0
                Arc2.Vertexes[0].Bulge = Math.Tan(40 * pi / 180 / 4);
                fun.PolyFill(dxf, Arc2, 0.3, contour);

                LwPolyline hatchpoly1 = new LwPolyline();
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v1));
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v2));//0
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v50));//1
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v53));//2
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v43));//3
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v42));//4
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v41));//5
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v40));//6
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v49));//7
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v1));//8
                hatchpoly1.Vertexes[0].Bulge = -Math.Tan((90 - (Math.Atan(7 / 24) * 180 / pi)) * pi / 180 / 4);
                hatchpoly1.Vertexes[2].Bulge = Math.Tan(40 * pi / 180 / 4);
                hatchpoly1.IsClosed = true;
                String[] htype1 = new String[100];
                Line[] hline1 = new Line[100];
                Arc[] harc1 = new Arc[100];
                int hnumst1 = hatchpoly1.Explode().Count;  //记录爆炸后，线段有多少
                for (int i = 0; i < hnumst1; i++)
                {
                    htype1[i] = hatchpoly1.Explode()[i].Type.ToString();    //将所有的元素记录成一个数组
                    if (htype1[i] == "Line")
                    {
                        hline1[i] = (Line)hatchpoly1.Explode()[i];
                    }
                    if (htype1[i] == "Arc")
                    {
                        harc1[i] = (Arc)hatchpoly1.Explode()[i];
                    }
                }
                fun.hatchsub1(dxf, htype1, hnumst1, 45, 10, hline1, harc1, hatching);

                LwPolyline hatchpoly2 = new LwPolyline();
                hatchpoly2.Vertexes.Add(new LwPolylineVertex(v38));
                hatchpoly2.Vertexes.Add(new LwPolylineVertex(v37));//0
                hatchpoly2.Vertexes.Add(new LwPolylineVertex(v36));//1
                hatchpoly2.Vertexes.Add(new LwPolylineVertex(v54));//2
                hatchpoly2.Vertexes.Add(new LwPolylineVertex(v45));//3
                hatchpoly2.Vertexes.Add(new LwPolylineVertex(v46));//4
                hatchpoly2.Vertexes.Add(new LwPolylineVertex(v47));//5
                hatchpoly2.Vertexes.Add(new LwPolylineVertex(v48));//6
                hatchpoly2.Vertexes.Add(new LwPolylineVertex(v39));//7
                hatchpoly2.Vertexes.Add(new LwPolylineVertex(v38));//8
                hatchpoly2.Vertexes[0].Bulge = Math.Tan((90 - (Math.Atan(7 / 24) * 180 / pi)) * pi / 180 / 4);
                hatchpoly2.Vertexes[2].Bulge = -Math.Tan(40 * pi / 180 / 4);
                hatchpoly2.IsClosed = true;
                String[] htype2 = new String[100];
                Line[] hline2 = new Line[100];
                Arc[] harc2 = new Arc[100];
                int hnumst2 = hatchpoly2.Explode().Count;  //记录爆炸后，线段有多少
                for (int i = 0; i < hnumst1; i++)
                {
                    htype2[i] = hatchpoly2.Explode()[i].Type.ToString();    //将所有的元素记录成一个数组
                    if (htype2[i] == "Line")
                    {
                        hline2[i] = (Line)hatchpoly2.Explode()[i];
                    }
                    if (htype2[i] == "Arc")
                    {
                        harc2[i] = (Arc)hatchpoly2.Explode()[i];
                    }
                }
                fun.hatchsub1(dxf, htype2, hnumst2, 45, 10, hline2, harc2, hatching);

                Line centreline = new Line(v94, v95);
                centreline.Layer = centre;
                centreline.LinetypeScale = 5;
                centreline.Lineweight = Lineweight.W25;
                centreline.Linetype = Linetype.Dashed;
                dxf.AddEntity(centreline);

                Vector2[] Line4 = { v18, v19 };
                fun.drawBLine(dxf, Line4, 0.3, contour);

                //第2部分
                //点
                Vector2 v98_1 = new Vector2(v95.X + l1, v95.Y);
                Vector2 v99 = new Vector2(v98_1.X + l5 * 4, v98_1.Y);
                Vector2 v102 = new Vector2(v98_1.X + fun.CalDistance(v98_1, v99) / 2, v98_1.Y);
                Vector2 v100 = new Vector2(v102.X, v102.Y + fun.CalDistance(v98_1, v99) / 2);
                Vector2 v101 = new Vector2(v102.X, v102.Y - fun.CalDistance(v98_1, v99) / 2);
                Vector2 v103 = new Vector2(v102.X - Math.Tan(Math.Acos(b / 2 / (d5 / 2))) * b / 2, v102.Y + b / 2);
                Vector2 v105 = new Vector2(v102.X - l6, v103.Y - l7);
                Vector2 v104 = new Vector2(v105.X - l7, v103.Y);
                Vector2 v110 = new Vector2(v103.X, -v103.Y);
                Vector2 v106 = new Vector2(v105.X, -v105.Y);
                Vector2 v107 = new Vector2(v104.X, -v104.Y);
                Vector2 v118 = new Vector2(v102.X + Math.Tan(Math.Acos(b / 2 / (d5 / 2))) * b / 2, v102.Y + b / 2);
                Vector2 v115 = new Vector2(v102.X + l6, v118.Y - l7);
                Vector2 v116 = new Vector2(v115.X + l7, v115.Y + l7);
                Vector2 v111 = new Vector2(v118.X, -v118.Y);
                Vector2 v113 = new Vector2(v116.X, -v116.Y);
                Vector2 v114 = new Vector2(v115.X, -v115.Y);

                Arc arc1_2_1 = new Arc(v102, fun.CalDistance(v102, v103), 0, -90);
                Vector2 v113_1 = fun.getPointForArcandLine(v113, new Vector2(v113.X, v113.Y - l1), v102, arc1_2_1);
                Vector2 v113_3 = fun.mirrorpoint(v113_1, v102, fun.Polar(v102, -45 * pi / 180, 10));
                Vector2 v113_2 = new Vector2(v102.X + j, v113_1.Y);

                //作图
                fun.drawcircle(dxf, v102, fun.CalDistance(v42, v46) / 2, 0.3, contour);
                fun.drawcircle(dxf, v102, fun.CalDistance(v41, v47) / 2, 0.01, contour);
                fun.drawcircle(dxf, v102, fun.CalDistance(v49, v39) / 2, 0.01, contour);
                fun.drawcircle(dxf, v102, l6, 0.3, contour);
                fun.drawcircle(dxf, v102, fun.CalDistance(v2, v37) / 2, 0.3, contour);
                fun.drawcircle(dxf, v102, d5 / 2, 0.3, contour);

                LwPolyline ddx1 = new LwPolyline();
                ddx1.Vertexes.Add(new LwPolylineVertex(v103));
                ddx1.Vertexes.Add(new LwPolylineVertex(v104));//0
                ddx1.Vertexes.Add(new LwPolylineVertex(v105));//1
                ddx1.Vertexes.Add(new LwPolylineVertex(v106));//2
                ddx1.Vertexes.Add(new LwPolylineVertex(v107));//3
                ddx1.Vertexes.Add(new LwPolylineVertex(v110));//4
                ddx1.Vertexes.Add(new LwPolylineVertex(v111));//5
                ddx1.Vertexes.Add(new LwPolylineVertex(v113));//6
                ddx1.Vertexes.Add(new LwPolylineVertex(v114));//7
                ddx1.Vertexes.Add(new LwPolylineVertex(v115));//8
                ddx1.Vertexes.Add(new LwPolylineVertex(v116));//9
                ddx1.Vertexes.Add(new LwPolylineVertex(v118));//10
                ddx1.Vertexes.Add(new LwPolylineVertex(v103));//11
                ddx1.Vertexes[5].Bulge = Math.Tan(Math.Acos(b / 2 / (d5 / 2)) * 2 / 4);
                ddx1.Vertexes[11].Bulge = Math.Tan(Math.Acos(b / 2 / (d5 / 2)) * 2 / 4);
                fun.PolyFill(dxf, ddx1, 0.3, contour);

                Line centreline1_2_1 = new Line(v98_1, v99);
                centreline1_2_1.Linetype = Linetype.Center;
                centreline1_2_1.Lineweight = Lineweight.W25;
                centreline1_2_1.Layer = centre;
                dxf.AddEntity(centreline1_2_1);

                Line centreline1_2_2 = new Line(v100, v101);
                centreline1_2_2.Linetype = Linetype.Center;
                centreline1_2_2.Lineweight = Lineweight.W25;
                centreline1_2_2.Layer = centre;
                dxf.AddEntity(centreline1_2_2);

                Vector2[] Line19 = { v116, v113 };
                fun.drawBLine(dxf, Line19, 0.3, contour);

                Vector2[] Line20 = { v104, v107 };
                fun.drawBLine(dxf, Line20, 0.3, contour);

                //标注样式
                //箭头样式
                DimensionStyle dimensionStyle = fun.CreateDimStyle();
                dimensionStyle.ArrowSize = 1;
                dimensionStyle.ExtLineExtend = 0.6;//标注延长线长度/2
                dimensionStyle.DimArrow1 = DimensionArrowhead.Closedfilled;
                dimensionStyle.DimArrow2 = DimensionArrowhead.Closedfilled;

                //文本样式
                dimensionStyle.TextHeight = 1;

                //线段尺寸标注
                //1_1
                LinearDimension dim1 = new LinearDimension(new Line(v1, p3_1), d6 / 2, 0, dimensionStyle);
                dim1.UserText = "l1=" + Math.Round(l1 * scale, 1);
                dxf.AddEntity(dim1);

                LinearDimension dim4 = new LinearDimension(new Line(v1, v41), d6 - d6 / 6 * 4, 0, dimensionStyle);
                dim4.UserText = "l4=" + Math.Round(l4 * scale, 1);
                dxf.AddEntity(dim4);

                double f = fun.CalDistance(v11, v17);
                LinearDimension dim7 = new LinearDimension(new Line(v10, v17), d6 - d6 / 6 * 3 - (v10.Y - v1.Y), 0, dimensionStyle);
                dim7.UserText = "(f)=" + Math.Round(f * scale, 1);
                dxf.AddEntity(dim7);

                LinearDimension dim8 = new LinearDimension(new Line(p3_1, v10), d6 - d6 / 6 * 4 - (v10.Y - v3.Y), 0, dimensionStyle);
                dim8.UserText = "y=" + Math.Round(y * scale, 1);
                dxf.AddEntity(dim8);

                LinearDimension dim10 = new LinearDimension(new Line(v17, v23), l1 * 1.3 - (v17.X - v10.X), -90, dimensionStyle);
                dim10.UserText = "φd5=" + Math.Round(d5 * scale, 1);
                dxf.AddEntity(dim10);

                LinearDimension dim23 = new LinearDimension(new Line(p3_1, p3_2), fun.CalDistance(v4, v5), 90, dimensionStyle);
                dim23.UserText = "φd1=" + Math.Round(d1 * scale, 1);
                dxf.AddEntity(dim23);

                //1_2
                LinearDimension dim13 = new LinearDimension(new Line(v105, v102), b * 3, 0, dimensionStyle);
                dim13.UserText = "l6=" + Math.Round(l6 * scale, 1);
                dxf.AddEntity(dim13);

                LinearDimension dim14 = new LinearDimension(new Line(v102, v115), b * 3, 0, dimensionStyle);
                dim14.UserText = "l6=" + Math.Round(l6 * scale, 1);
                dxf.AddEntity(dim14);

                LinearDimension dim15 = new LinearDimension(new Line(v118, v111), b * 2, -90, dimensionStyle);
                dim15.UserText = "2×b=" + Math.Round(b * scale, 1);
                dxf.AddEntity(dim15);

                LinearDimension dim16 = new LinearDimension(new Line(v118, v115), b, -90, dimensionStyle);
                dim16.UserText = "4×l7b=" + Math.Round(l7 * scale, 1);
                dxf.AddEntity(dim16);

                double d10 = fun.CalDistance(v43, v45);
                LinearDimension dim18 = new LinearDimension(new Line(v43, v45), b, -90, dimensionStyle);
                dim18.UserText = "φd10=" + Math.Round(d10 * scale, 1);
                dxf.AddEntity(dim18);

                //公差
                fun.gcbz(dxf, new Vector2(v1.X, v1.Y + d6 / 2), 10, 180, 0.1, 180, 5, 1, 1, "A", "0.02", 2, "ytd", 1);
                fun.gcbz(dxf, new Vector2(v23.X + l1 * 1.3 - (v17.X - v10.X) - 2, v23.Y), 10, -90, 5, 180, 5, 1, 1, "A", "0.05", 2, "ytd", 1);
                fun.gcbz(dxf, new Vector2(v111.X + b * 2 - 2, v111.Y), 20, -90, 5, 180, 5, 1, 1, "A", "t3", 2, "dcd", 0.5);
            }

            if (ctrap == 6)
            {
                //A型和U型
                //坐标
                Vector2 v6 = new Vector2(v5.X, v5.Y - 1 * scale);
                Vector2 v7 = new Vector2(v6.X + y / 3, v6.Y);
                Vector2 v8 = new Vector2(v7.X, v7.Y + 1 * scale);
                Vector2 v9 = new Vector2(v3.X + fun.CalDistance(v4, v5) * 2, v3.Y);
                Vector2 v10 = new Vector2(v9.X, d5 / 2);
                Vector2 v11 = new Vector2(v10.X + (u - y) * 1 / 2, v10.Y);
                Vector2 v12 = new Vector2(v11.X + (d5 - d4) / 2 * Math.Tan(30 * pi / 180), v11.Y - (d5 - d4) / 2);
                Vector2 v13 = new Vector2(v12.X, v12.Y);
                Vector2 v14 = new Vector2(v13.X + (u - y) * 1 / 4, v13.Y);
                Vector2 v15 = new Vector2(v14.X + (d5 - d4) / 2 * Math.Tan(30 * pi / 180), v14.Y + (d5 - d4) / 2);
                Vector2 v16 = new Vector2(v14.X + (d5 - d4) / 2 * Math.Tan(30 * pi / 180), v14.Y + (d5 - d4) / 2);
                Vector2 v17 = new Vector2(v16.X + (u - y) * 1 / 4, v16.Y);
                Vector2 v18 = new Vector2(v17.X, v17.Y - (d5 / 2 - (d5 - d3)));
                Vector2 v21 = new Vector2(v18.X, -v18.Y);
                Vector2 v23 = new Vector2(v17.X, -v17.Y);
                Vector2 v22 = new Vector2(v21.X, v21.Y - fun.CalDistance(v21, v23) / 3);
                Vector2 v24 = new Vector2(v16.X, -v16.Y);
                Vector2 v25 = new Vector2(v14.X, -v14.Y);
                Vector2 v26 = new Vector2(v13.X, -v13.Y);
                Vector2 v27 = new Vector2(v11.X, -v11.Y);
                Vector2 v28 = new Vector2(v10.X, -v10.Y);
                Vector2 v29 = new Vector2(v9.X, -v9.Y);
                Vector2 v30 = new Vector2(v8.X, -v8.Y);
                Vector2 v31 = new Vector2(v7.X, -v7.Y);
                Vector2 v32 = new Vector2(v6.X, -v6.Y);
                Vector2 v33 = new Vector2(v5.X, -v5.Y);
                Vector2 v34 = new Vector2(v4.X, -v4.Y);
                Vector2 v35 = new Vector2(v3.X, -v3.Y);
                Vector2 v37 = new Vector2(v2.X, -v2.Y);
                Vector2 v38 = new Vector2(v1.X, -v1.Y);
                Vector2 v49 = new Vector2(v1.X, d11 / 2);
                Vector2 v39 = new Vector2(v49.X, -v49.Y);
                Vector2 v40 = new Vector2(v49.X + Math.Cos(45 * pi / 180) * r2, d2 / 2);
                Vector2 v41 = new Vector2(v40.X + (l4 - Math.Cos(45 * pi / 180) * r2), v40.Y);
                Vector2 v42 = fun.Polar(v41, -45 * pi / 180, r2);
                Vector2 v98 = new Vector2(v41.X + (l2 - l4), v42.Y);
                Vector2 v43 = new Vector2(v1.X + l3, v42.Y);
                Vector2 v44 = new Vector2(v43.X + v43.Y / 2, v94.Y);
                Vector2 v45 = new Vector2(v43.X, -v43.Y);
                Vector2 v46 = new Vector2(v42.X, -v42.Y);
                Vector2 v47 = new Vector2(v41.X, -v41.Y);
                Vector2 v48 = new Vector2(v40.X, -v40.Y);
                Vector2 v36 = fun.Polar(v35, ((180 - Math.Atan((v3.Y - v2.Y) / (v3.X - v2.X)) * 180 / pi)) * pi / 180, l1 * 1 / 4 / Math.Cos(α));
                Vector2 v50 = new Vector2(v36.X, -v36.Y);
                Vector2 v51 = new Vector2(v50.X, v50.Y - d1 * 1 / 8);
                Vector2 v52 = fun.Polar(v51, -70 * pi / 180, fun.CalDistance(v43, v44) * 2 / 3);
                Vector2 v53 = fun.Polar(v52, -60 * pi / 180, fun.CalDistance(v43, v44) * 1 / 3);
                Vector2 v54 = new Vector2(v53.X, -v53.Y);
                Vector2 v55 = new Vector2(v52.X, -v52.Y);
                Vector2 v56 = new Vector2(v51.X, -v51.Y);
                Vector2 v96 = new Vector2(v13.X + fun.CalDistance(v13, v14) / 2, v13.Y + (d5 / 2 - d4 / 2) * 4);
                Vector2 v97 = new Vector2(v96.X, v27.Y - (d5 / 2 - d4 / 2) * 4);
                Vector2 v57_1 = new Vector2(v13.X - Math.Sin(30 * pi / 180) * fun.CalDistance(v11, v13) / 2, v13.Y + fun.CalDistance(v13, v14) / 2 / Math.Tan(30 * pi / 180));
                Vector2 v57_2 = new Vector2(v14.X + Math.Sin(30 * pi / 180) * fun.CalDistance(v11, v13) / 2, v14.Y + fun.CalDistance(v13, v14) / 2 / Math.Tan(30 * pi / 180));//切点
                Vector2 v57 = new Vector2(v96.X, v57_1.Y + fun.CalDistance(v57_1, v57_2) / 2 / Math.Tan(60 * pi / 180));
                Vector2 v58 = new Vector2(v57.X, v94.Y);
                Vector2 v59 = new Vector2(v57.X, -v57.Y);

                Vector2 v51_1 = new Vector2(v9.X, v9.Y + fun.CalDistance(v3, v4));
                Vector2 v52_1 = new Vector2(v51_1.X, v51_1.Y + fun.CalDistance(v3, v9));
                Vector2 v53_1 = fun.Polar(v52_1, -45 * pi / 180, fun.CalDistance(v9, v10) * 1.5);
                Vector2 v55_1 = fun.Polar(v53_1, -135 * pi / 180, fun.CalDistance(fun.Inters(v51_1, fun.Polar(v51_1, 45 * pi / 180, l1), v52_1, v53_1), v51_1));
                Vector2 v54_1 = fun.Polar(new Vector2(v51_1.X, v51_1.Y + fun.CalDistance(v51_1, v52_1) / 2), -45 * pi / 180, fun.CalDistance(v52_1, v53_1));
                Vector2 v51_2 = new Vector2(v51_1.X, -v51_1.Y);
                Vector2 v52_2 = new Vector2(v52_1.X, -v52_1.Y);
                Vector2 v53_2 = new Vector2(v53_1.X, -v53_1.Y);
                Vector2 v54_2 = new Vector2(v54_1.X, -v54_1.Y);
                Vector2 v55_2 = new Vector2(v55_1.X, -v55_1.Y);

                Vector2 bu1 = new Vector2(v18.X, v9.Y);
                Vector2 bu1_1 = new Vector2(bu1.X + e / 3, bu1.Y);
                Vector2 bu2 = new Vector2(bu1.X, -bu1.Y);
                Vector2 bu2_1 = new Vector2(bu1_1.X, -bu1_1.Y);
                Vector2 bu3 = new Vector2(bu1_1.X, bu1_1.Y - fun.CalAngle(bu1_1, bu2_1) / 3);
                Vector2 bu4 = fun.Polar(bu3, -105 * pi / 180, fun.CalAngle(bu1_1, bu2_1) / 5);
                Vector2 bu5 = new Vector2(bu4.X - fun.CalAngle(bu1_1, bu2_1) / 8, v94.Y);
                Vector2 bu6 = new Vector2(bu3.X, -bu3.Y);
                Vector2 bu7 = new Vector2(bu4.X, -bu4.Y);

                //样条线点
                Vector2 p1 = new Vector2(bu1_1.X, bu1.Y - d3 / 6);
                Vector2 p2 = fun.Polar(p1, -100 * pi / 180, d3 / 6);
                Vector2 p3 = fun.Inters(p2, fun.Polar(p2, -100 * pi / 180, l1), v94, v95);
                Vector2 p4 = new Vector2(p3.X, -p3.Y);
                Vector2 p5 = new Vector2(p2.X, -p2.Y);
                Vector2 p6 = new Vector2(p1.X, -p1.Y);

                Vector2 v66 = new Vector2(bu1_1.X - fun.CalDistance(bu1, bu1_1) / 4 * 3, bu1.Y);
                Vector2 p1_1 = new Vector2(v66.X, v66.Y - d3 / 6);
                Vector2 p2_1 = fun.Polar(p1_1, -100 * pi / 180, d3 / 6);
                Vector2 p3_1_1 = fun.Inters(p2_1, fun.Polar(p2_1, -100 * pi / 180, l1), v94, v95);
                Vector2 p4_1 = new Vector2(p3_1_1.X, -p3_1_1.Y);
                Vector2 p5_1 = new Vector2(p2_1.X, -p2_1.Y);
                Vector2 p6_1 = new Vector2(p1_1.X, -p1_1.Y);
                Vector2 v67 = new Vector2(v66.X, -v66.Y);

                //新增虚线点

                Vector2 v64 = fun.Inters(p2, fun.Polar(p2, pi, l1), v53_1, fun.Polar(v53_1, -45 * pi / 180, l1));
                Vector2 v65 = new Vector2(v64.X, -v64.Y);
                Vector2 v61 = fun.Inters(v55_1, fun.Polar(v55_1, -45 * pi / 180, l1), v94, v95);

                //作图
                LwPolyline polyline1 = new LwPolyline();
                polyline1.Vertexes.Add(new LwPolylineVertex(v1));
                polyline1.Vertexes.Add(new LwPolylineVertex(v2));//0
                polyline1.Vertexes.Add(new LwPolylineVertex(v3));//1
                polyline1.Vertexes.Add(new LwPolylineVertex(v9));//2
                polyline1.Vertexes.Add(new LwPolylineVertex(v10));//3
                polyline1.Vertexes.Add(new LwPolylineVertex(v11));//4
                polyline1.Vertexes.Add(new LwPolylineVertex(v13));//5
                polyline1.Vertexes.Add(new LwPolylineVertex(v14));//6
                polyline1.Vertexes.Add(new LwPolylineVertex(v16));//7
                polyline1.Vertexes.Add(new LwPolylineVertex(v17));//8
                polyline1.Vertexes.Add(new LwPolylineVertex(bu1));//9
                polyline1.Vertexes.Add(new LwPolylineVertex(bu1_1));//10
                polyline1.Vertexes[0].Bulge = -Math.Tan((90 - (Math.Atan(7 / 24) * 180 / pi)) * pi / 180 / 4);
                fun.PolyFill(dxf, polyline1, 0.3, contour);

                LwPolyline polyline2 = new LwPolyline();
                polyline2.Vertexes.Add(new LwPolylineVertex(bu1_1));
                polyline2.Vertexes.Add(new LwPolylineVertex(p1));//0
                polyline2.Vertexes.Add(new LwPolylineVertex(p2));//1
                polyline2.Vertexes.Add(new LwPolylineVertex(p3));//2
                polyline2.Vertexes.Add(new LwPolylineVertex(p4));//3
                polyline2.Vertexes.Add(new LwPolylineVertex(p5));//4
                polyline2.Vertexes.Add(new LwPolylineVertex(p6));//5
                polyline2.Vertexes.Add(new LwPolylineVertex(bu2_1));//6
                polyline2.Vertexes[0].Bulge = -Math.Tan(40 * pi / 180 / 4);
                polyline2.Vertexes[1].Bulge = Math.Tan(20 * pi / 180 / 4);
                polyline2.Vertexes[2].Bulge = Math.Tan(20 * pi / 180 / 4);
                polyline2.Vertexes[3].Bulge = Math.Tan(20 * pi / 180 / 4);
                polyline2.Vertexes[4].Bulge = Math.Tan(20 * pi / 180 / 4);
                polyline2.Vertexes[5].Bulge = Math.Tan(20 * pi / 180 / 4);
                polyline2.Vertexes[6].Bulge = -Math.Tan(40 * pi / 180 / 4);
                fun.PolyFill(dxf, polyline2, 0.1, additionalline);

                LwPolyline polyline3 = new LwPolyline();
                polyline3.Vertexes.Add(new LwPolylineVertex(bu2_1));
                polyline3.Vertexes.Add(new LwPolylineVertex(bu2));
                polyline3.Vertexes.Add(new LwPolylineVertex(v23));
                polyline3.Vertexes.Add(new LwPolylineVertex(v24));
                polyline3.Vertexes.Add(new LwPolylineVertex(v25));
                polyline3.Vertexes.Add(new LwPolylineVertex(v26));
                polyline3.Vertexes.Add(new LwPolylineVertex(v27));
                polyline3.Vertexes.Add(new LwPolylineVertex(v28));
                polyline3.Vertexes.Add(new LwPolylineVertex(v29));
                polyline3.Vertexes.Add(new LwPolylineVertex(v35));
                polyline3.Vertexes.Add(new LwPolylineVertex(v37));
                polyline3.Vertexes.Add(new LwPolylineVertex(v38));//10
                polyline3.Vertexes.Add(new LwPolylineVertex(v1));
                polyline3.Vertexes[10].Bulge = -Math.Tan((90 - (Math.Atan(7 / 24) * 180 / pi)) * pi / 180 / 4);
                fun.PolyFill(dxf, polyline3, 0.3, contour);

                LwPolyline polyline4 = new LwPolyline();
                polyline4.Vertexes.Add(new LwPolylineVertex(v50));
                polyline4.Vertexes.Add(new LwPolylineVertex(v51));//0
                polyline4.Vertexes.Add(new LwPolylineVertex(v52));//1
                polyline4.Vertexes.Add(new LwPolylineVertex(v53));//2
                polyline4.Vertexes.Add(new LwPolylineVertex(v54));//3
                polyline4.Vertexes.Add(new LwPolylineVertex(v55));//4
                polyline4.Vertexes.Add(new LwPolylineVertex(v56));//5
                polyline4.Vertexes.Add(new LwPolylineVertex(v36));//6
                polyline4.Vertexes[1].Bulge = Math.Tan(10 * pi / 180);
                polyline4.Vertexes[2].Bulge = -Math.Tan(10 * pi / 180);
                polyline4.Vertexes[3].Bulge = -Math.Tan(5 * pi / 180);
                polyline4.Vertexes[4].Bulge = -Math.Tan(10 * pi / 180);
                polyline4.Vertexes[5].Bulge = Math.Tan(10 * pi / 180);
                fun.PolyFill(dxf, polyline4, 0.1, additionalline);

                LwPolyline polyline5 = new LwPolyline();
                polyline5.Vertexes.Add(new LwPolylineVertex(v66));
                polyline5.Vertexes.Add(new LwPolylineVertex(p1_1));//0
                polyline5.Vertexes.Add(new LwPolylineVertex(p2_1));//1
                polyline5.Vertexes.Add(new LwPolylineVertex(p3_1_1));//2
                polyline5.Vertexes.Add(new LwPolylineVertex(p4_1));//3
                polyline5.Vertexes.Add(new LwPolylineVertex(p5_1));//4
                polyline5.Vertexes.Add(new LwPolylineVertex(p6_1));//5
                polyline5.Vertexes.Add(new LwPolylineVertex(v67));//6
                polyline5.Vertexes[0].Bulge = -Math.Tan(40 * pi / 180 / 4);
                polyline5.Vertexes[1].Bulge = Math.Tan(20 * pi / 180 / 4);
                polyline5.Vertexes[2].Bulge = Math.Tan(20 * pi / 180 / 4);
                polyline5.Vertexes[3].Bulge = Math.Tan(20 * pi / 180 / 4);
                polyline5.Vertexes[4].Bulge = Math.Tan(20 * pi / 180 / 4);
                polyline5.Vertexes[5].Bulge = Math.Tan(20 * pi / 180 / 4);
                fun.PolyFill(dxf, polyline5, 0.1, additionalline);

                LwPolyline polyline6 = new LwPolyline();
                polyline6.Vertexes.Add(new LwPolylineVertex(v52_1));
                polyline6.Vertexes.Add(new LwPolylineVertex(v53_1));
                polyline6.Vertexes.Add(new LwPolylineVertex(v55_1));
                polyline6.Vertexes.Add(new LwPolylineVertex(v51_1));
                fun.PolyFill(dxf, polyline6, 0.3, contour);

                LwPolyline polyline7 = new LwPolyline();
                polyline7.Vertexes.Add(new LwPolylineVertex(v53_1));
                polyline7.Vertexes.Add(new LwPolylineVertex(v54_1));
                polyline7.Vertexes.Add(new LwPolylineVertex(v55_1));
                fun.PolyFill(dxf, polyline7, 0.3, contour);

                LwPolyline polyline8 = new LwPolyline();
                polyline8.Vertexes.Add(new LwPolylineVertex(v52_2));
                polyline8.Vertexes.Add(new LwPolylineVertex(v53_2));
                polyline8.Vertexes.Add(new LwPolylineVertex(v55_2));
                polyline8.Vertexes.Add(new LwPolylineVertex(v51_2));
                fun.PolyFill(dxf, polyline8, 0.3, contour);

                LwPolyline polyline9 = new LwPolyline();
                polyline9.Vertexes.Add(new LwPolylineVertex(v53_2));
                polyline9.Vertexes.Add(new LwPolylineVertex(v54_2));
                polyline9.Vertexes.Add(new LwPolylineVertex(v55_2));
                fun.PolyFill(dxf, polyline9, 0.3, contour);

                Line line1 = new Line(v49, v40);
                line1.Layer = refin;
                line1.Linetype = Linetype.Dashed;
                line1.Lineweight = Lineweight.W25;
                dxf.AddEntity(line1);

                Line line2 = new Line(v40, v41);
                line2.Layer = refin;
                line2.Linetype = Linetype.Dashed;
                line2.Lineweight = Lineweight.W25;
                dxf.AddEntity(line2);

                Line line3 = new Line(v41, v42);
                line3.Layer = refin;
                line3.Linetype = Linetype.Dashed;
                line3.Lineweight = Lineweight.W25;
                dxf.AddEntity(line3);

                Line line4 = new Line(v42, v43);
                line4.Layer = refin;
                line4.Linetype = Linetype.Dashed;
                line4.Lineweight = Lineweight.W25;
                dxf.AddEntity(line4);

                Line line5 = new Line(v43, v44);
                line5.Layer = refin;
                line5.Linetype = Linetype.Dashed;
                line5.Lineweight = Lineweight.W25;
                dxf.AddEntity(line5);

                Line line7 = new Line(v41, v47);
                line7.Layer = refin;
                line7.Linetype = Linetype.Dashed;
                line7.Lineweight = Lineweight.W25;
                dxf.AddEntity(line7);

                Line line8 = new Line(v42, v46);
                line8.Layer = refin;
                line8.Linetype = Linetype.Dashed;
                line8.Lineweight = Lineweight.W25;
                dxf.AddEntity(line8);

                Line line9 = new Line(v40, v48);
                line9.Layer = refin;
                line9.Linetype = Linetype.Dashed;
                line9.Lineweight = Lineweight.W25;
                dxf.AddEntity(line9);

                Line line10 = new Line(v43, v45);
                line10.Layer = refin;
                line10.Linetype = Linetype.Dashed;
                line10.Lineweight = Lineweight.W25;
                dxf.AddEntity(line10);

                Line line11 = new Line(v53_1, v64);
                line11.Layer = refin;
                line11.Linetype = Linetype.Dashed;
                line11.Lineweight = Lineweight.W25;
                dxf.AddEntity(line11);

                Line line12 = new Line(v64, p2);
                line12.Layer = refin;
                line12.Linetype = Linetype.Dashed;
                line12.Lineweight = Lineweight.W25;
                dxf.AddEntity(line12);

                Line line13 = new Line(v55_1, v61);
                line13.Layer = refin;
                line13.Linetype = Linetype.Dashed;
                line13.Lineweight = Lineweight.W25;
                dxf.AddEntity(line13);

                Line line14 = new Line(v55_2, v61);
                line14.Layer = refin;
                line14.Linetype = Linetype.Dashed;
                line14.Lineweight = Lineweight.W25;
                dxf.AddEntity(line14);

                Line line15 = new Line(v53_2, v65);
                line15.Layer = refin;
                line15.Linetype = Linetype.Dashed;
                line15.Lineweight = Lineweight.W25;
                dxf.AddEntity(line15);

                Line line16 = new Line(v65, p5);
                line16.Layer = refin;
                line16.Linetype = Linetype.Dashed;
                line16.Lineweight = Lineweight.W25;
                dxf.AddEntity(line16);

                Line line17 = new Line(v44, v45);
                line17.Layer = refin;
                line17.Linetype = Linetype.Dashed;
                line17.Lineweight = Lineweight.W25;
                dxf.AddEntity(line17);

                Line line18 = new Line(v45, v46);
                line18.Layer = refin;
                line18.Linetype = Linetype.Dashed;
                line18.Lineweight = Lineweight.W25;
                dxf.AddEntity(line18);

                Line line19 = new Line(v46, v47);
                line19.Layer = refin;
                line19.Linetype = Linetype.Dashed;
                line19.Lineweight = Lineweight.W25;
                dxf.AddEntity(line19);

                Line line20 = new Line(v46, v47);
                line20.Layer = refin;
                line20.Linetype = Linetype.Dashed;
                line20.Lineweight = Lineweight.W25;
                dxf.AddEntity(line20);

                Line line21 = new Line(v48, v39);
                line21.Layer = refin;
                line21.Linetype = Linetype.Dashed;
                line21.Lineweight = Lineweight.W25;
                dxf.AddEntity(line21);

                Line line22 = new Line(v94, v95);
                line22.Layer = centre;
                line22.Linetype = Linetype.DashDot;
                line22.Lineweight = Lineweight.W25;
                dxf.AddEntity(line22);

                Line line23 = new Line(v96, v97);
                line23.Layer = centre;
                line23.Linetype = Linetype.DashDot;
                line23.Lineweight = Lineweight.W25;
                dxf.AddEntity(line23);

                Line line24 = new Line(v47, v48);
                line24.Layer = refin;
                line24.Linetype = Linetype.Dashed;
                line24.Lineweight = Lineweight.W25;
                dxf.AddEntity(line24);

                //填充
                LwPolyline hatchpoly1 = new LwPolyline();
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v50));
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v3));//0
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v9));//1
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v10));//2
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v11));//3
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v13));//4
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v14));//5
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v16));//6
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v17));//7
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(bu1));//8
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v66));//9
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(p1_1));//10
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(p2_1));//11
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(p3_1_1));//12
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(p4_1));//13
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(p5_1));//14
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(p6_1));//15
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v67));//16
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(bu2));//17
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v23));//18
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v24));//19
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v25));//20
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v26));//21
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v27));//22
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v28));//23
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v29));//24
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v36));//25
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v56));//26
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v55));//27
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v54));//28
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v53));//29
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v52));//30
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v51));//31
                hatchpoly1.Vertexes.Add(new LwPolylineVertex(v50));//32
                hatchpoly1.Vertexes[10].Bulge = -Math.Tan(40 * pi / 180 / 4);
                hatchpoly1.Vertexes[11].Bulge = Math.Tan(20 * pi / 180 / 4);
                hatchpoly1.Vertexes[12].Bulge = Math.Tan(20 * pi / 180 / 4);
                hatchpoly1.Vertexes[13].Bulge = Math.Tan(20 * pi / 180 / 4);
                hatchpoly1.Vertexes[14].Bulge = Math.Tan(20 * pi / 180 / 4);
                hatchpoly1.Vertexes[15].Bulge = Math.Tan(20 * pi / 180 / 4);
                hatchpoly1.Vertexes[27].Bulge = -Math.Tan(10 * pi / 180);
                hatchpoly1.Vertexes[28].Bulge = Math.Tan(10 * pi / 180);
                hatchpoly1.Vertexes[29].Bulge = Math.Tan(5 * pi / 180);
                hatchpoly1.Vertexes[30].Bulge = Math.Tan(10 * pi / 180);
                hatchpoly1.Vertexes[31].Bulge = -Math.Tan(10 * pi / 180);
                hatchpoly1.IsClosed = true;
                String[] htype1 = new String[100];
                Line[] hline1 = new Line[100];
                Arc[] harc1 = new Arc[100];
                int hnumst1 = hatchpoly1.Explode().Count;  //记录爆炸后，线段有多少
                for (int i = 0; i < hnumst1; i++)
                {
                    htype1[i] = hatchpoly1.Explode()[i].Type.ToString();    //将所有的元素记录成一个数组
                    if (htype1[i] == "Line")
                    {
                        hline1[i] = (Line)hatchpoly1.Explode()[i];
                    }
                    if (htype1[i] == "Arc")
                    {
                        harc1[i] = (Arc)hatchpoly1.Explode()[i];
                    }
                }
                fun.hatchsub1(dxf, htype1, hnumst1, 45, 10, hline1, harc1, hatching);

                //标注
                //标注样式
                //箭头样式
                DimensionStyle dimensionStyle = fun.CreateDimStyle();
                dimensionStyle.ArrowSize = 1;
                dimensionStyle.ExtLineExtend = 0.6;//标注延长线长度/2
                dimensionStyle.DimArrow1 = DimensionArrowhead.Closedfilled;
                dimensionStyle.DimArrow2 = DimensionArrowhead.Closedfilled;

                //文本样式
                dimensionStyle.TextHeight = 1 * scale;

                //1_1
                LinearDimension dim1_1 = new LinearDimension(new Line(v1, p3_1), d6, 0, dimensionStyle);
                dim1_1.UserText = "l1=" + Math.Round(l1 * scale, 1);
                dxf.AddEntity(dim1_1);

                LinearDimension dim2_1 = new LinearDimension(new Line(v39, v45), d6 - d6 / 2, 180, dimensionStyle);
                dim2_1.UserText = "l3=" + Math.Round(l3 * scale, 1);
                dxf.AddEntity(dim2_1);

                LinearDimension dim4 = new LinearDimension(new Line(v1, v41), d6 - d6 / 6 * 3, 0, dimensionStyle);
                dim4.UserText = "l4=" + Math.Round(l4 * scale, 1);
                dxf.AddEntity(dim4);

                LinearDimension dim5 = new LinearDimension(new Line(p3_1, new Vector2(bu1_1.X - fun.CalDistance(bu1, bu1_1) / 6, bu1.Y)), d6 - (bu1_1.Y - v3.Y), 0, dimensionStyle);
                dim5.UserText = "e=" + Math.Round(e * scale, 1);
                dxf.AddEntity(dim5);

                LinearDimension dim6 = new LinearDimension(new Line(p3_1, v17), d6 - d6 / 6 * 2 - (bu1_1.Y - v3.Y), 0, dimensionStyle);
                dim6.UserText = "u=" + Math.Round(u * scale, 1);
                dxf.AddEntity(dim6);

                double f = fun.CalDistance(v11, v17);
                LinearDimension dim7 = new LinearDimension(new Line(v10, v17), d6 - d6 / 6 * 3 - (v10.Y - v1.Y), 0, dimensionStyle);
                dim7.UserText = "(f)=" + Math.Round(f * scale, 1);
                dxf.AddEntity(dim7);

                LinearDimension dim8 = new LinearDimension(new Line(p3_1, v10), d6 - d6 / 6 * 4 - (v10.Y - v3.Y), 0, dimensionStyle);
                dim8.UserText = "y=" + Math.Round(y * scale, 1);
                dxf.AddEntity(dim8);

                LinearDimension dim10 = new LinearDimension(new Line(v17, v23), l1 * 1.3 - (v17.X - v10.X), -90, dimensionStyle);
                dim10.UserText = "φd5=" + Math.Round(d5 * scale, 1);
                dxf.AddEntity(dim10);

                LinearDimension dim11 = new LinearDimension(new Line(v14, v25), l1 * 1.2 - (v17.X - v10.X), -90, dimensionStyle);
                dim11.UserText = "φd4=" + Math.Round(d4 * scale, 1);
                dxf.AddEntity(dim11);

                LinearDimension dim12 = new LinearDimension(new Line(bu1, bu2), l1 * 0.8 - (v17.X - v10.X), -90, dimensionStyle);
                dim12.UserText = "φd3=" + Math.Round(d3 * scale, 1);
                dxf.AddEntity(dim12);

                double e1 = fun.CalDistance(v57, v52) / 2;
                LinearDimension dim1 = new LinearDimension(new Line(new Vector2(v51_1.X, v51_1.Y + fun.CalDistance(v51, v52) / 2), v44), 0, 90, dimensionStyle);
                dim1.UserText = "e1=" + Math.Round(e1 * scale, 1);
                dxf.AddEntity(dim1);
                LinearDimension dim2 = new LinearDimension(new Line(new Vector2(v51_2.X, v51_2.Y - fun.CalDistance(v51, v52) / 2), v44), 0, 90, dimensionStyle);
                dim2.UserText = "e1=" + Math.Round(e1 * scale, 1);
                dxf.AddEntity(dim2);

                LinearDimension dim23 = new LinearDimension(new Line(p3_1, p3_2), fun.CalDistance(v4, v5) * 2, -90, dimensionStyle);
                dim23.UserText = "φd1=" + Math.Round(d1 * scale, 1);
                dxf.AddEntity(dim23);

                Vector2 bzd = new Vector2(v51_1.X, v51_1.Y + fun.CalDistance(v51, v52) / 2);
                fun.jdbz1(dxf, new Line(bzd, fun.Polar(bzd, pi, 0.1)), new Line(bzd, fun.Polar(bzd, 135 * pi / 180, 0.1)), 20, "≤35°", 3);

                //第2部分
                //点
                Vector2 v98_1 = new Vector2(v95.X + l1, v95.Y);
                Vector2 v99 = new Vector2(v98_1.X + l5 * 4, v98_1.Y);
                Vector2 v102 = new Vector2(v98_1.X + fun.CalDistance(v98_1, v99) / 2, v98_1.Y);
                Vector2 v100 = new Vector2(v102.X, v102.Y + fun.CalDistance(v98_1, v99) / 2);
                Vector2 v101 = new Vector2(v102.X, v102.Y - fun.CalDistance(v98_1, v99) / 2);
                Vector2 v103 = new Vector2(v102.X - Math.Tan(Math.Acos(b / 2 / (d5 / 2))) * b / 2, v102.Y + b / 2);
                Vector2 v105 = new Vector2(v102.X - l6, v103.Y - l7);
                Vector2 v104 = new Vector2(v105.X - l7, v103.Y);
                Vector2 v110 = new Vector2(v103.X, -v103.Y);
                Vector2 v106 = new Vector2(v105.X, -v105.Y);
                Vector2 v107 = new Vector2(v104.X, -v104.Y);
                Vector2 v118 = new Vector2(v102.X + Math.Tan(Math.Acos(b / 2 / (d5 / 2))) * b / 2, v102.Y + b / 2);
                Vector2 v115 = new Vector2(v102.X + l6, v118.Y - l7);
                Vector2 v116 = new Vector2(v115.X + l7, v115.Y + l7);
                Vector2 v111 = new Vector2(v118.X, -v118.Y);
                Vector2 v113 = new Vector2(v116.X, -v116.Y);
                Vector2 v114 = new Vector2(v115.X, -v115.Y);

                Vector2 v103_r = fun.rotatePoint_Changed(v102, v103, 90);
                Vector2 v104_r = fun.rotatePoint_Changed(v102, v104, 90);
                Vector2 v105_r = fun.rotatePoint_Changed(v102, v105, 90);
                Vector2 v106_r = fun.rotatePoint_Changed(v102, v106, 90);
                Vector2 v107_r = fun.rotatePoint_Changed(v102, v107, 90);
                Vector2 v110_r = fun.rotatePoint_Changed(v102, v110, 90);
                Vector2 v118_r = fun.rotatePoint_Changed(v102, v118, 90);
                Vector2 v116_r = fun.rotatePoint_Changed(v102, v116, 90);
                Vector2 v115_r = fun.rotatePoint_Changed(v102, v115, 90);
                Vector2 v111_r = fun.rotatePoint_Changed(v102, v111, 90);
                Vector2 v113_r = fun.rotatePoint_Changed(v102, v113, 90);
                Vector2 v114_r = fun.rotatePoint_Changed(v102, v114, 90);
                Vector2 v100_r = fun.rotatePoint_Changed(v102, v100, 90);
                Vector2 v101_r = fun.rotatePoint_Changed(v102, v101, 90);
                Vector2 v98_1_r = fun.rotatePoint_Changed(v102, v98_1, 90);
                Vector2 v99_r = fun.rotatePoint_Changed(v102, v99, 90);

                //作图
                fun.drawcircle(dxf, v102, fun.CalDistance(v42, v46) / 2, 0.3, contour);
                fun.drawcircle(dxf, v102, fun.CalDistance(v41, v47) / 2, 0.01, contour);
                fun.drawcircle(dxf, v102, fun.CalDistance(v49, v39) / 2, 0.01, contour);
                fun.drawcircle(dxf, v102, l6, 0.3, contour);
                fun.drawcircle(dxf, v102, fun.CalDistance(v2, v37) / 2, 0.3, contour);
                fun.drawcircle(dxf, v102, d5 / 2, 0.3, contour);

                LwPolyline ddx1 = new LwPolyline();
                ddx1.Vertexes.Add(new LwPolylineVertex(v103_r));
                ddx1.Vertexes.Add(new LwPolylineVertex(v104_r));//0
                ddx1.Vertexes.Add(new LwPolylineVertex(v105_r));//1
                ddx1.Vertexes.Add(new LwPolylineVertex(v106_r));//2
                ddx1.Vertexes.Add(new LwPolylineVertex(v107_r));//3
                ddx1.Vertexes.Add(new LwPolylineVertex(v110_r));//4
                ddx1.Vertexes.Add(new LwPolylineVertex(v111_r));//5
                ddx1.Vertexes.Add(new LwPolylineVertex(v113_r));//6
                ddx1.Vertexes.Add(new LwPolylineVertex(v114_r));//7
                ddx1.Vertexes.Add(new LwPolylineVertex(v115_r));//8
                ddx1.Vertexes.Add(new LwPolylineVertex(v116_r));//9
                ddx1.Vertexes.Add(new LwPolylineVertex(v118_r));//10
                ddx1.Vertexes.Add(new LwPolylineVertex(v103_r));//11
                ddx1.Vertexes[5].Bulge = Math.Tan(Math.Acos(b / 2 / (d5 / 2)) * 2 / 4);
                ddx1.Vertexes[11].Bulge = Math.Tan(Math.Acos(b / 2 / (d5 / 2)) * 2 / 4);
                fun.PolyFill(dxf, ddx1, 0.3, contour);

                Line centreline1_2_1 = new Line(v98_1_r, v99_r);
                centreline1_2_1.Linetype = Linetype.Center;
                centreline1_2_1.Lineweight = Lineweight.W25;
                centreline1_2_1.Layer = centre;
                dxf.AddEntity(centreline1_2_1);

                Line centreline1_2_2 = new Line(v100_r, v101_r);
                centreline1_2_2.Linetype = Linetype.Center;
                centreline1_2_2.Lineweight = Lineweight.W25;
                centreline1_2_2.Layer = centre;
                dxf.AddEntity(centreline1_2_2);

                Vector2[] Line19 = { v116_r, v113_r };
                fun.drawBLine(dxf, Line19, 0.3, contour);

                Vector2[] Line20 = { v104_r, v107_r };
                fun.drawBLine(dxf, Line20, 0.3, contour);

                //标注
                fun.jdbz1(dxf, new Line(v102, new Vector2(v102.X - 0.1, v102.Y)), new Line(v102, fun.Polar(v102, 160 * pi / 180, 0.1)), 25, "20°", 3);

                LinearDimension dim13 = new LinearDimension(new Line(v105_r, v102), b * 2, 90, dimensionStyle);
                dim13.UserText = "l6=" + Math.Round(l6 * scale, 1);
                dxf.AddEntity(dim13);

                LinearDimension dim14 = new LinearDimension(new Line(v102, v115_r), b * 2, 90, dimensionStyle);
                dim14.UserText = "l6=" + Math.Round(l6 * scale, 1);
                dxf.AddEntity(dim14);

                LinearDimension dim15 = new LinearDimension(new Line(v118_r, v111_r), b * 2, 0, dimensionStyle);
                dim15.UserText = "2×b=" + Math.Round(b * scale, 1);
                dxf.AddEntity(dim15);

                LinearDimension dim16 = new LinearDimension(new Line(v118_r, v115_r), b, 0, dimensionStyle);
                dim16.UserText = "4×l7b=" + Math.Round(l7 * scale, 1);
                dxf.AddEntity(dim16);

                //公差
                fun.gcbz(dxf, new Vector2(v1.X, v1.Y + d6), 10, 180, 0.1, 180, 5, 1, 1, "A", "0.02", 2, "ytd", 1);
                fun.gcbz(dxf, new Vector2(v23.X + l1 * 1.3 - (v17.X - v10.X) - 2, v23.Y), 10, -90, 5, 180, 5, 1, 1, "A", "0.05", 2, "ytd", 1);
                fun.gcbz(dxf, new Vector2(v111_r.X, v111_r.Y + b * 2 - 2), 10, 0, 0.1, 0, 5, 1, 1, "A", "t3", 2, "dcd", 0.5);
            }

            double isframe = Convert.ToInt32(data["isframe"]);
            String isframe_chose = Convert.ToString(data["isframe_chose"]);
            Vector2 p0 = new Vector2(0, 0);
            if (isframe == 1)
            {
                if (isframe_chose.Equals("0"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA0X(dxf, new Vector2(p0.X - 1189 / 2.0, p0.Y + 841 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("1"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA1X(dxf, new Vector2(p0.X - 841 / 2.0, p0.Y + 594 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("2"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA2X(dxf, new Vector2(p0.X - 594 / 2.0, p0.Y + 420 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("3"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA3X(dxf, new Vector2(p0.X - 420 / 2.0, p0.Y + 297 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("4X"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA4X(dxf, new Vector2(p0.X - 297 / 2.0, p0.Y + 210 / 2.0 - 10 * 2.26), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("4Y"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA4Y(dxf, new Vector2(p0.X - 210 / 2.0, p0.Y + 297 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }
            }


            //定义格式，根据路径导出
            dxf.DrawingVariables.AcadVer = DxfVersion.AutoCad2007;
            dxf.Save(path);
        }
    }
}
